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 collection
T - type of collection implementation

public abstract class SelfSchedulingWorker<V,T extends Collection<V>> extends ReschedulingTask
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 Details

    • SelfSchedulingWorker

      public SelfSchedulingWorker(Plugin plugin, int maxIdleTicks)
    • SelfSchedulingWorker

      public SelfSchedulingWorker(Plugin plugin)
  • Method Details

    • execute

      protected abstract void execute(V object)
      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 class ReschedulingTask
    • register

      protected final void register(V object)
    • unregister

      public final void unregister(V object)
    • getQueueImplementation

      protected abstract 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