Package org.cache2k.core.timing
Class DefaultTimer
- java.lang.Object
-
- org.cache2k.core.timing.DefaultTimer
-
- All Implemented Interfaces:
NeedsClose,Timer
public class DefaultTimer extends Object implements Timer
Standard timer implementation. Due timer tasks are executed via a scheduler that runs at most every second (lag time, configurable). There is always only one pending scheduler job per timer.- Author:
- Jens Wilke
-
-
Constructor Summary
Constructors Constructor Description DefaultTimer(org.cache2k.operation.TimeReference clock, org.cache2k.operation.Scheduler scheduler, long lagMillis)DefaultTimer(org.cache2k.operation.TimeReference c, org.cache2k.operation.Scheduler scheduler, long lagMillis, int steps)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel(TimerTask t)Cancel the timer task.voidcancelAll()Terminates all timer tasks current pending.voidclose(InternalCacheCloseContext closeContext)longgetLagMillis()Lag to gather timer tasks processing.voidschedule(TimerTask task, long time)Schedule the specified timer task for execution at the specified time, in milliseconds.
-
-
-
Method Detail
-
schedule
public void schedule(TimerTask task, long time)
Schedule the specified timer task for execution at the specified time, in milliseconds.
-
cancel
public void cancel(TimerTask t)
Description copied from interface:TimerCancel the timer task.
-
getLagMillis
public long getLagMillis()
Lag to gather timer tasks processing. In milliseconds.- Specified by:
getLagMillisin interfaceTimer
-
cancelAll
public void cancelAll()
Terminates all timer tasks current pending.
-
close
public void close(InternalCacheCloseContext closeContext)
- Specified by:
closein interfaceNeedsClose
-
-