Interface Timer
-
- All Known Implementing Classes:
ThreadTimer
public interface TimerTimer allows scheduling tasks for execution in the future. Tasks are always executed on a well-definedExecutor. Timer implementations must have a default executor for tasks scheduled usingschedule(long, Runnable). Tasks scheduled usingschedule(long, Runnable, Executor)are executed on the given executor.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TimerTaskschedule(long delayInMillis, Runnable task)TimerTaskschedule(long delayInMillis, Runnable task, Executor executor)Schedules thetaskto be executed indelayInMillison givenexecutor.voidshutdown()Shuts down this timer.
-
-
-
Method Detail
-
schedule
TimerTask schedule(long delayInMillis, Runnable task)
Schedules thetaskto be executed indelayInMillison this timer's defaultExecutor.Equivalent to
schedule(delayInMillis, task, null).
-
schedule
TimerTask schedule(long delayInMillis, Runnable task, Executor executor)
Schedules thetaskto be executed indelayInMillison givenexecutor. Ifexecutorisnull, this timer's default executor is used.
-
shutdown
void shutdown() throws InterruptedExceptionShuts down this timer. Returns after all internal resources of this timer are shut down.- Throws:
InterruptedException
-
-