Class QueuingSelfSchedulingTask<T>
java.lang.Object
de.eldoria.eldoutilities.threading.ReschedulingTask
de.eldoria.eldoutilities.scheduling.QueuingSelfSchedulingTask<T>
- Direct Known Subclasses:
DelayedActions
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final int
protected static final int
-
Constructor Summary
ConstructorDescriptionQueuingSelfSchedulingTask
(Plugin plugin) QueuingSelfSchedulingTask
(Plugin plugin, int maxIdleTicks, int maxDurationTarget) -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear all the queued objects and cancel the task.abstract void
handle one object which was polled from the queueprotected boolean
Define if this object should be polled from queue or if the scheduler should proceed to the next tick.protected boolean
protected boolean
final void
run()
protected final void
final void
shutdown()
Shuts down the scheduler.void
tick()
Tick is executed once per tick.
-
Field Details
-
DEFAULT_MAX_DURATION_TARGET
protected static final int DEFAULT_MAX_DURATION_TARGET- See Also:
-
DEFAULT_MAX_IDLE_TICKS
protected static final int DEFAULT_MAX_IDLE_TICKS- See Also:
-
-
Constructor Details
-
QueuingSelfSchedulingTask
-
QueuingSelfSchedulingTask
-
-
Method Details
-
execute
handle one object which was polled from the queue- Parameters:
object
- object from queue
-
tick
public void tick()Tick is executed once per tick. -
run
public final void run()- Specified by:
run
in classReschedulingTask
-
proceed
Define if this object should be polled from queue or if the scheduler should proceed to the next tick.- Parameters:
object
- object to check- Returns:
- true if the object should be handeld. false if the task should wait.
-
schedule
-
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
-
clear
public void clear()Clear all the queued objects and cancel the task. It can be scheduled again after this. -
remove
-
removeIf
-