-
- All Superinterfaces:
TimerRef
- All Known Implementing Classes:
AgentTimer
public interface TimerContext extends TimerRef
Internal context that binds aTimerto aSchedule. ATimerContextcan be used by aTimerto check its status, to reschedule itself, and to cancel itself.TimerContextis thread safe.- See Also:
Timer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancancel()Cancels the timer to prevent it from executing.booleanisScheduled()Returnstrueif the timer is currently scheduled to execute.voidreschedule(long millis)Schedules the timer to execute aftermillismilliseconds has elapsed.Scheduleschedule()Returns theScheduleto which the timer is bound.
-
-
-
Method Detail
-
schedule
Schedule schedule()
Returns theScheduleto which the timer is bound.
-
isScheduled
boolean isScheduled()
Returnstrueif the timer is currently scheduled to execute.- Specified by:
isScheduledin interfaceTimerRef
-
reschedule
void reschedule(long millis)
Schedules the timer to execute aftermillismilliseconds has elapsed. If the timer is currently scheduled, it will not ececute at its previously scheduled time; it will only execute at the newly scheduled time.- Specified by:
reschedulein interfaceTimerRef- Throws:
TimerException- ifmillisis negative.
-
-