-
- All Superinterfaces:
TimerRef
- All Known Implementing Classes:
AgentTimer
public interface TimerContext extends TimerRef
Internal context that binds aTimer
to aSchedule
. ATimerContext
can be used by aTimer
to check its status, to reschedule itself, and to cancel itself.TimerContext
is thread safe.- See Also:
Timer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
cancel()
Cancels the timer to prevent it from executing.boolean
isScheduled()
Returnstrue
if the timer is currently scheduled to execute.void
reschedule(long millis)
Schedules the timer to execute aftermillis
milliseconds has elapsed.Schedule
schedule()
Returns theSchedule
to which the timer is bound.
-
-
-
Method Detail
-
schedule
Schedule schedule()
Returns theSchedule
to which the timer is bound.
-
isScheduled
boolean isScheduled()
Returnstrue
if the timer is currently scheduled to execute.- Specified by:
isScheduled
in interfaceTimerRef
-
reschedule
void reschedule(long millis)
Schedules the timer to execute aftermillis
milliseconds 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:
reschedule
in interfaceTimerRef
- Throws:
TimerException
- ifmillis
is negative.
-
-