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(@NotNull Runnable command)
    Executes the specified command on the next particle system tick.
    boolean
     
    schedule(@NotNull Runnable command, int delay)
    Schedules the specified command to run in the specified number of ticks.
    schedule(@NotNull Callable<V> callable, int delay)
    Schedules the specified command to run in the specified number of ticks.
    scheduleAtFixedRate(@NotNull 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(@NotNull @NotNull 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(@NotNull @NotNull 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(@NotNull @NotNull 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(@NotNull @NotNull 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