Interface Scheduler

All Superinterfaces:
Executor
All Known Implementing Classes:
ConcurrentScheduler

public interface Scheduler extends Executor
The Scheduler interface represents a means to execute a task immediately or after a specified delay. This queues the task for the requested period of time before it is executed, if a delay is specified. How the task is executed is dependent on the implementation, however it will normally use a thread pool.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    execute(Runnable task, long delay)
    This will execute the task within the executor after the time specified has expired.
    void
    execute(Runnable task, long delay, TimeUnit unit)
    This will execute the task within the executor after the time specified has expired.

    Methods inherited from interface java.util.concurrent.Executor

    execute
  • Method Details

    • execute

      void execute(Runnable task, long delay)
      This will execute the task within the executor after the time specified has expired. If the time specified is zero then it will be executed immediately. Once the scheduler has been stopped then this method will no longer accept runnable tasks.
      Parameters:
      task - this is the task to schedule for execution
      delay - the time in milliseconds to wait for execution
    • execute

      void execute(Runnable task, long delay, TimeUnit unit)
      This will execute the task within the executor after the time specified has expired. If the time specified is zero then it will be executed immediately. Once the scheduler has been stopped then this method will no longer accept runnable tasks.
      Parameters:
      task - this is the task to schedule for execution
      delay - this is the delay to wait before execution
      unit - this is the duration time unit to wait for