S - the type of stateE - the type of eventpublic class TimerTrigger<S,E> extends LifecycleObjectSupport implements Trigger<S,E>
Trigger capable of firing on a
static periods.| Constructor and Description |
|---|
TimerTrigger(long period)
Instantiates a new timer trigger.
|
TimerTrigger(long period,
int count)
Instantiates a new timer trigger.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addTriggerListener(TriggerListener listener)
Adds the trigger listener.
|
void |
arm()
Arm a trigger.
|
void |
disarm()
Disarm a trigger.
|
protected void |
doStart()
Subclasses may implement this method with the start behavior.
|
protected void |
doStop()
Subclasses may implement this method with the stop behavior.
|
boolean |
evaluate(TriggerContext<S,E> context)
Evaluate trigger.
|
E |
getEvent()
Gets the event associated with this trigger.
|
afterPropertiesSet, destroy, doDestroy, getBeanFactory, getPhase, getTaskExecutor, getTaskScheduler, isAutoStartup, isRunning, onInit, setAutoStartup, setBeanFactory, setPhase, setTaskExecutor, setTaskScheduler, start, stop, stoppublic TimerTrigger(long period)
period - the period in millisecondspublic TimerTrigger(long period,
int count)
period - the periodcount - the countpublic boolean evaluate(TriggerContext<S,E> context)
Triggerpublic void addTriggerListener(TriggerListener listener)
TriggeraddTriggerListener in interface Trigger<S,E>listener - the listenerpublic E getEvent()
Triggerprotected void doStart()
LifecycleObjectSupportLifecycleObjectSupport.lifecycleLock.doStart in class LifecycleObjectSupportprotected void doStop()
LifecycleObjectSupportLifecycleObjectSupport.lifecycleLock.doStop in class LifecycleObjectSupportpublic void arm()
TriggerTriggerListener
may receive events.