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
ConstructorDescriptionSelfSchedulingWorker
(Plugin plugin) SelfSchedulingWorker
(Plugin plugin, int maxIdleTicks) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
handle one object which was polled from the queueprotected abstract T
protected final void
final void
run()
final void
shutdown()
Shuts down the scheduler.protected void
tick()
Tick is executed once per tick.final void
unregister
(V object)
-
Constructor Details
-
SelfSchedulingWorker
-
SelfSchedulingWorker
-
-
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:
run
in classReschedulingTask
-
register
-
unregister
-
getQueueImplementation
-
shutdown
public final void shutdown()Description copied from class:ReschedulingTask
Shuts down the scheduler. It can be not scheduled again after this.- Overrides:
shutdown
in classReschedulingTask
-