public interface Timer
TimerTask
s for one-time future execution in a background
thread.限定符和类型 | 方法和说明 |
---|---|
Timeout |
newTimeout(TimerTask task,
long delay,
java.util.concurrent.TimeUnit unit)
Schedules the specified
TimerTask for one-time execution after
the specified delay. |
java.util.Set<Timeout> |
stop()
Releases all resources acquired by this
Timer and cancels all
tasks which were scheduled but not executed yet. |
Timeout newTimeout(TimerTask task, long delay, java.util.concurrent.TimeUnit unit)
TimerTask
for one-time execution after
the specified delay.java.lang.IllegalStateException
- if this timer has been stopped alreadyjava.util.concurrent.RejectedExecutionException
- if the pending timeouts are too many and creating new timeout
can cause instability in the system.