Class AbstractSyncExecutor

java.lang.Object
me.moros.tasker.executor.AbstractSyncExecutor
All Implemented Interfaces:
Executor, SyncExecutor, TaskExecutor, TickAdapter

public abstract class AbstractSyncExecutor extends Object implements SyncExecutor
An abstract sync executor utilizing that delegates to a TimerWheel.
  • Field Details

  • Constructor Details

    • AbstractSyncExecutor

      protected AbstractSyncExecutor(TimerWheel wheel)
    • AbstractSyncExecutor

      protected AbstractSyncExecutor()
  • Method Details

    • submit

      public <V> CompletableFuture<@PolyNull V> submit(Supplier<@PolyNull V> task, int ticks)
      Description copied from interface: TaskExecutor
      Submit a task.
      Specified by:
      submit in interface TaskExecutor
      Type Parameters:
      V - the type of result the task returns
      Parameters:
      task - the task to submit
      ticks - the delay before the task is executed in game ticks
      Returns:
      the scheduled task as a future
    • repeat

      public Task repeat(Consumer<? super Task> consumer, int ticks, int periodTicks)
      Description copied from interface: SyncExecutor
      Schedule a repeating task.
      Specified by:
      repeat in interface SyncExecutor
      Parameters:
      consumer - the task to schedule
      ticks - the delay before the first task execution in game ticks
      periodTicks - how often to repeat the task in game ticks
      Returns:
      the scheduled task
    • clear

      public final void clear()
      Description copied from interface: SyncExecutor
      Clear all scheduled tasks in this executor without shutting down.
      Specified by:
      clear in interface SyncExecutor
    • shutdown

      public void shutdown()
      Description copied from interface: TaskExecutor
      Safely shutdown this executor.
      Specified by:
      shutdown in interface TaskExecutor
    • checkValid

      protected void checkValid()