- 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 TypeMethodDescriptionvoid
runTimer()
Executes scheduled logic when thisTimer
fires.void
setTimerContext
(TimerContext timerContext) Sets the context used to manage thisTimer
.Returns the context used to manage thisTimer
.void
Lifecycle callback invoked after thisTimer
is explicitly cancelled.void
timerWillSchedule
(long millis) Lifecycle callback invoked before thisTimer
is scheduled for execution.
-
Method Details
-
timerContext
TimerContext timerContext()Returns the context used to manage thisTimer
. Returnsnull
if thisTimer
is not bound to aSchedule
. -
setTimerContext
Sets the context used to manage thisTimer
. ATimerContext
is assigned when binding thisTimer
to aSchedule
. -
runTimer
void runTimer()Executes scheduled logic when thisTimer
fires.- Specified by:
runTimer
in interfaceTimerFunction
-
timerWillSchedule
void timerWillSchedule(long millis) Lifecycle callback invoked before thisTimer
is scheduled for execution. -
timerDidCancel
void timerDidCancel()Lifecycle callback invoked after thisTimer
is explicitly cancelled.
-