Interface Scheduler

All Known Implementing Classes:
SchedulerImpl

public interface Scheduler
Task scheduling management interface integrated with ExecutorManager.

Uses a single dedicated clock thread to count down time offsets and subsequently dispatches execution payloads to either the CPU thread pool or the I/O thread pool.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    cancelTask(int taskId)
    Cancels an active or scheduled task matching the unique task ID.
    runTask(Runnable runnable)
    Executes a task immediately on the primary CPU-bound thread pool.
    Executes a task immediately on the asynchronous I/O-bound thread pool.
    runTaskLater(Runnable runnable, long delay, TimeUnit unit)
    Schedules a task to execute after a specified delay on the CPU thread pool.
    runTaskLaterAsync(Runnable runnable, long delay, TimeUnit unit)
    Schedules a task to execute asynchronously after a specified delay on the I/O thread pool.
    runTaskTimer(Runnable runnable, long delay, long period, TimeUnit unit)
    Schedules a repeated task to execute on the CPU thread pool.
    runTaskTimerAsync(Runnable runnable, long delay, long period, TimeUnit unit)
    Schedules a repeated task to execute asynchronously on the I/O thread pool.
    void
    Cancels all currently scheduled tasks and releases underlying thread pool resources.
  • Method Details

    • runTask

      Task runTask(Runnable runnable)
      Executes a task immediately on the primary CPU-bound thread pool.
      Parameters:
      runnable - the task logic to execute
      Returns:
      a tracked Task instance
    • runTaskAsync

      Task runTaskAsync(Runnable runnable)
      Executes a task immediately on the asynchronous I/O-bound thread pool.
      Parameters:
      runnable - the task logic to execute
      Returns:
      a tracked Task instance
    • runTaskLater

      Task runTaskLater(Runnable runnable, long delay, TimeUnit unit)
      Schedules a task to execute after a specified delay on the CPU thread pool.
      Parameters:
      runnable - the task logic to execute
      delay - the time to wait before executing
      unit - the time unit of the delay parameter
      Returns:
      a tracked Task instance
    • runTaskLaterAsync

      Task runTaskLaterAsync(Runnable runnable, long delay, TimeUnit unit)
      Schedules a task to execute asynchronously after a specified delay on the I/O thread pool.
      Parameters:
      runnable - the task logic to execute
      delay - the time to wait before executing
      unit - the time unit of the delay parameter
      Returns:
      a tracked Task instance
    • runTaskTimer

      Task runTaskTimer(Runnable runnable, long delay, long period, TimeUnit unit)
      Schedules a repeated task to execute on the CPU thread pool.
      Parameters:
      runnable - the task logic to execute
      delay - the time to wait before the first execution
      period - the interval between successive executions
      unit - the time unit of the delay and period parameters
      Returns:
      a tracked Task instance
    • runTaskTimerAsync

      Task runTaskTimerAsync(Runnable runnable, long delay, long period, TimeUnit unit)
      Schedules a repeated task to execute asynchronously on the I/O thread pool.
      Parameters:
      runnable - the task logic to execute
      delay - the time to wait before the first execution
      period - the interval between successive executions
      unit - the time unit of the delay and period parameters
      Returns:
      a tracked Task instance
    • cancelTask

      void cancelTask(int taskId)
      Cancels an active or scheduled task matching the unique task ID.
      Parameters:
      taskId - the unique identifier of the target task
    • shutdown

      void shutdown()
      Cancels all currently scheduled tasks and releases underlying thread pool resources.