Interface TickTaskScheduler

All Superinterfaces:
Executor
All Known Implementing Classes:
TickTaskSchedulerImpl

public interface TickTaskScheduler extends Executor
Schedules tasks to be run on future ticks.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    execute(Runnable command)
    Executes the specified command on the next particle system tick.
    boolean
     
    schedule(Runnable command, int delay)
    Schedules the specified command to run in the specified number of ticks.
    schedule(Callable<V> callable, int delay)
    Schedules the specified command to run in the specified number of ticks.
    scheduleAtFixedRate(Runnable command, int initialDelay, int period)
    Schedules the specified command to run after the specified initial delay in ticks and at each fixed time interval in ticks.
  • Method Details

    • execute

      void execute(Runnable command)
      Executes the specified command on the next particle system tick.
      Specified by:
      execute in interface Executor
      Parameters:
      command - The runnable task
      Throws:
      RejectedExecutionException - if the task cannot be scheduled for execution
      NullPointerException - if command is null
    • schedule

      CompletableFuture<?> schedule(Runnable command, int delay)
      Schedules the specified command to run in the specified number of ticks.
      Parameters:
      command - The runnable task
      delay - The delay in ticks
      Returns:
      A future that completes after the task has been run
      Throws:
      RejectedExecutionException - if the task cannot be scheduled for execution
      NullPointerException - if command is null
      IllegalArgumentException - if delay less than or equal to zero
    • schedule

      <V> CompletableFuture<V> schedule(Callable<V> callable, int delay)
      Schedules the specified command to run in the specified number of ticks.
      Parameters:
      callable - The callable task
      delay - The delay in ticks
      Returns:
      A future that completes after the task has been run
      Throws:
      RejectedExecutionException - if the task cannot be scheduled for execution
      NullPointerException - if command is null
      IllegalArgumentException - if delay less than or equal to zero
    • scheduleAtFixedRate

      CompletableFuture<?> scheduleAtFixedRate(Runnable command, int initialDelay, int period)
      Schedules the specified command to run after the specified initial delay in ticks and at each fixed time interval in ticks.
      Parameters:
      command - The runnable task
      initialDelay - The initial delay in ticks
      period - The period between task executions
      Returns:
      A future that completes if there was an error
      Throws:
      RejectedExecutionException - if the task cannot be scheduled for execution
      NullPointerException - if command is null
      IllegalArgumentException - if delay less than or equal to zero
    • isShutdown

      boolean isShutdown()
      Returns:
      Whether the executor has shut down and will reject