Class QueuingSelfSchedulingTask<T>

java.lang.Object
de.eldoria.eldoutilities.threading.ReschedulingTask
de.eldoria.eldoutilities.scheduling.QueuingSelfSchedulingTask<T>
Direct Known Subclasses:
DelayedActions

public abstract class QueuingSelfSchedulingTask<T> extends ReschedulingTask
  • 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

      public QueuingSelfSchedulingTask(Plugin plugin, int maxIdleTicks, int maxDurationTarget)
    • QueuingSelfSchedulingTask

      public QueuingSelfSchedulingTask(Plugin plugin)
  • Method Details

    • execute

      public abstract void execute(T object)
      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 class ReschedulingTask
    • proceed

      protected boolean proceed(T object)
      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

      protected final void schedule(T object)
    • getQueueImplementation

      protected Queue<T> 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 class ReschedulingTask
    • clear

      public void clear()
      Clear all the queued objects and cancel the task. It can be scheduled again after this.
    • remove

      protected boolean remove(T o)
    • removeIf

      protected boolean removeIf(Predicate<? super T> filter)