Class SelfSchedulingWorker<V,T extends Collection<V>>
java.lang.Object
de.eldoria.eldoutilities.threading.ReschedulingTask
de.eldoria.eldoutilities.scheduling.SelfSchedulingWorker<V,T>
- Type Parameters:
V- type of collectionT- type of collection implementation
A self scheduling worker which will schedule itself when getting tasks.
Will unschedule itself if no tasks are left for some time.
- Since:
- 1.4.0
-
Constructor Summary
ConstructorsConstructorDescriptionSelfSchedulingWorker(org.bukkit.plugin.Plugin plugin) SelfSchedulingWorker(org.bukkit.plugin.Plugin plugin, int maxIdleTicks) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidhandle one object which was polled from the queueprotected abstract Tprotected final voidfinal voidrun()final voidshutdown()Shuts down the scheduler.protected voidtick()Tick is executed once per tick.final voidunregister(V object)
-
Constructor Details
-
SelfSchedulingWorker
public SelfSchedulingWorker(org.bukkit.plugin.Plugin plugin, int maxIdleTicks) -
SelfSchedulingWorker
public SelfSchedulingWorker(org.bukkit.plugin.Plugin plugin)
-
-
Method Details
-
execute
handle one object which was polled from the queue- Parameters:
object- object from queue
-
tick
protected void tick()Tick is executed once per tick. -
run
public final void run()- Specified by:
runin classReschedulingTask
-
register
-
unregister
-
getQueueImplementation
-
shutdown
public final void shutdown()Description copied from class:ReschedulingTaskShuts down the scheduler. It can be not scheduled again after this.- Overrides:
shutdownin classReschedulingTask
-