Class TickTaskSchedulerImpl

java.lang.Object
foundry.veil.impl.TickTaskSchedulerImpl
All Implemented Interfaces:
TickTaskScheduler, Executor

@Internal public class TickTaskSchedulerImpl extends Object implements TickTaskScheduler
  • Constructor Details

    • TickTaskSchedulerImpl

      public TickTaskSchedulerImpl()
  • Method Details

    • run

      public void run()
      Runs a single tick and executes all pending tasks for that time.
    • shutdown

      public void shutdown()
      Stops the scheduler and runs all pending tasks as quickly as possible.
    • execute

      public void execute(Runnable command)
      Description copied from interface: TickTaskScheduler
      Executes the specified command on the next particle system tick.
      Specified by:
      execute in interface Executor
      Specified by:
      execute in interface TickTaskScheduler
      Parameters:
      command - The runnable task
    • schedule

      public CompletableFuture<?> schedule(Runnable command, int delay)
      Description copied from interface: TickTaskScheduler
      Schedules the specified command to run in the specified number of ticks.
      Specified by:
      schedule in interface TickTaskScheduler
      Parameters:
      command - The runnable task
      delay - The delay in ticks
      Returns:
      A future that completes after the task has been run
    • schedule

      public <V> CompletableFuture<V> schedule(Callable<V> callable, int delay)
      Description copied from interface: TickTaskScheduler
      Schedules the specified command to run in the specified number of ticks.
      Specified by:
      schedule in interface TickTaskScheduler
      Parameters:
      callable - The callable task
      delay - The delay in ticks
      Returns:
      A future that completes after the task has been run
    • scheduleAtFixedRate

      public CompletableFuture<?> scheduleAtFixedRate(Runnable command, int initialDelay, int period)
      Description copied from interface: TickTaskScheduler
      Schedules the specified command to run after the specified initial delay in ticks and at each fixed time interval in ticks.
      Specified by:
      scheduleAtFixedRate in interface TickTaskScheduler
      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
    • isShutdown

      public boolean isShutdown()
      Specified by:
      isShutdown in interface TickTaskScheduler
      Returns:
      Whether the executor has shut down and will reject