Package org.apache.dubbo.common.timer
Interface Timer
- All Known Implementing Classes:
HashedWheelTimer
public interface Timer
Schedules
TimerTasks for one-time future execution in a background
thread.-
Method Summary
Modifier and TypeMethodDescriptionbooleanisStop()the timer is stopnewTimeout(TimerTask task, long delay, TimeUnit unit) Schedules the specifiedTimerTaskfor one-time execution after the specified delay.stop()Releases all resources acquired by thisTimerand cancels all tasks which were scheduled but not executed yet.
-
Method Details
-
newTimeout
Schedules the specifiedTimerTaskfor one-time execution after the specified delay.- Returns:
- a handle which is associated with the specified task
- Throws:
IllegalStateException- if this timer has been stopped alreadyRejectedExecutionException- if the pending timeouts are too many and creating new timeout can cause instability in the system.
-
stop
Releases all resources acquired by thisTimerand cancels all tasks which were scheduled but not executed yet.- Returns:
- the handles associated with the tasks which were canceled by this method
-
isStop
boolean isStop()the timer is stop- Returns:
- true for stop
-