-
- All Superinterfaces:
TimerFunction
- All Known Implementing Classes:
AbstractTimer,AgentTimer
public interface Timer extends TimerFunction
StatefulTimerFunctionto invoke at a scheduled time, with lifecycle callbacks, and aTimerContextfor self-management. UseSchedule.setTimer(long, TimerFunction)to schedule a newTimerfor execution.- See Also:
AbstractTimer,Schedule
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidrunTimer()Executes scheduled logic when thisTimerfires.voidsetTimerContext(TimerContext timerContext)Sets the context used to manage thisTimer.TimerContexttimerContext()Returns the context used to manage thisTimer.voidtimerDidCancel()Lifecycle callback invoked after thisTimeris explicitly cancelled.voidtimerWillSchedule(long millis)Lifecycle callback invoked before thisTimeris scheduled for execution.
-
-
-
Method Detail
-
timerContext
TimerContext timerContext()
Returns the context used to manage thisTimer. Returnsnullif thisTimeris not bound to aSchedule.
-
setTimerContext
void setTimerContext(TimerContext timerContext)
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.
-
-