Interface Scheduler
-
- All Superinterfaces:
java.util.concurrent.Executor
- All Known Implementing Classes:
ConcurrentScheduler
public interface Scheduler extends java.util.concurrent.Executor
TheScheduler
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
execute(java.lang.Runnable task, long delay)
This will execute the task within the executor after the time specified has expired.void
execute(java.lang.Runnable task, long delay, java.util.concurrent.TimeUnit unit)
This will execute the task within the executor after the time specified has expired.
-
-
-
Method Detail
-
execute
void execute(java.lang.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 executiondelay
- the time in milliseconds to wait for execution
-
execute
void execute(java.lang.Runnable task, long delay, java.util.concurrent.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 executiondelay
- this is the delay to wait before executionunit
- this is the duration time unit to wait for
-
-