Interface TimerService
- All Known Implementing Classes:
TimerServiceImpl
public interface TimerService
Service interface for repeated callbacks at regular intervals.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Disable statistics.void
Enable statistics.long
Return invocation count.long
Return last drift.long
Return maximum drift.long
Return total drift.void
setCallback
(TimerCallback timerCallback) Set the callback method to invoke for clock ticks.void
Start clock expecting callbacks at regular intervals and a fixed rate.void
stopInternalClock
(boolean warnIfNotStarted) Stop internal clock.
-
Method Details
-
setCallback
Set the callback method to invoke for clock ticks.- Parameters:
timerCallback
- is the callback
-
startInternalClock
void startInternalClock()Start clock expecting callbacks at regular intervals and a fixed rate. Catch-up callbacks are possible should the callback fall behind. -
stopInternalClock
void stopInternalClock(boolean warnIfNotStarted) Stop internal clock.- Parameters:
warnIfNotStarted
- use true to indicate whether to warn if the clock is not started, use false to not warn and expect the clock to be not started.
-
enableStats
void enableStats()Enable statistics. -
disableStats
void disableStats()Disable statistics. -
getMaxDrift
long getMaxDrift()Return maximum drift.- Returns:
- drift
-
getLastDrift
long getLastDrift()Return last drift.- Returns:
- drift
-
getTotalDrift
long getTotalDrift()Return total drift.- Returns:
- drift
-
getInvocationCount
long getInvocationCount()Return invocation count.- Returns:
- count
-