- All Superinterfaces:
TimerFunction
- All Known Implementing Classes:
AbstractTimer,AgentTimer
Stateful
TimerFunction to invoke at a scheduled time, with lifecycle
callbacks, and a TimerContext for self-management. Use Schedule.setTimer(long, TimerFunction) to schedule a new Timer for
execution.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidrunTimer()Executes scheduled logic when thisTimerfires.voidsetTimerContext(TimerContext timerContext) Sets the context used to manage thisTimer.Returns the context used to manage thisTimer.voidLifecycle callback invoked after thisTimeris explicitly cancelled.voidtimerWillSchedule(long millis) Lifecycle callback invoked before thisTimeris scheduled for execution.
-
Method Details
-
timerContext
TimerContext timerContext()Returns the context used to manage thisTimer. Returnsnullif thisTimeris not bound to aSchedule. -
setTimerContext
Sets the context used to manage thisTimer. ATimerContextis assigned when binding thisTimerto aSchedule. -
runTimer
void runTimer()Executes scheduled logic when thisTimerfires.- Specified by:
runTimerin interfaceTimerFunction
-
timerWillSchedule
void timerWillSchedule(long millis) Lifecycle callback invoked before thisTimeris scheduled for execution. -
timerDidCancel
void timerDidCancel()Lifecycle callback invoked after thisTimeris explicitly cancelled.
-