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, stop
public TimerTrigger(long period)
period
- the period in millisecondspublic TimerTrigger(long period, int count)
period
- the periodcount
- the countpublic boolean evaluate(TriggerContext<S,E> context)
Trigger
public void addTriggerListener(TriggerListener listener)
Trigger
addTriggerListener
in interface Trigger<S,E>
listener
- the listenerpublic E getEvent()
Trigger
protected void doStart()
LifecycleObjectSupport
LifecycleObjectSupport.lifecycleLock
.doStart
in class LifecycleObjectSupport
protected void doStop()
LifecycleObjectSupport
LifecycleObjectSupport.lifecycleLock
.doStop
in class LifecycleObjectSupport
public void arm()
Trigger
TriggerListener
may receive events.