-
- All Known Subinterfaces:
TimerContext
- All Known Implementing Classes:
AgentTimer
public interface TimerRef
External handle to aTimerFunction
bound to aSchedule
. ATimerRef
can be used to check the status of a timer, to reschedule it, and to cancel it.TimerRef
is thread safe.- See Also:
Schedule
-
-
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.
-
-
-
Method Detail
-
isScheduled
boolean isScheduled()
Returnstrue
if the timer is currently scheduled to execute.
-
reschedule
void reschedule(long millis)
Schedules the timer to execute aftermillis
milliseconds has elapsed. If the timer is currently scheduled, it will not execute at its previously scheduled time; it will only execute at the newly scheduled time.- Throws:
TimerException
- ifmillis
is negative.
-
cancel
boolean cancel()
Cancels the timer to prevent it from executing. Returnstrue
if this operation caused the cancellation of the timer; returnsfalse
if the timer was not scheduled to execute.
-
-