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 reactor.core.publisher.Mono<java.lang.Void> |
doPreStartReactively()
Subclasses may implement this for pre start logic.
|
protected reactor.core.publisher.Mono<java.lang.Void> |
doPreStopReactively()
Subclasses may implement this for pre stop logic.
|
reactor.core.publisher.Mono<java.lang.Boolean> |
evaluate(TriggerContext<S,E> context)
Evaluate trigger.
|
int |
getCount() |
E |
getEvent()
Gets the event associated with this trigger.
|
long |
getPeriod() |
afterPropertiesSet, destroy, doDestroy, doPostStartReactively, doPostStopReactively, getBeanFactory, getPhase, isAutoStartup, isRunning, onInit, setAutoStartup, setBeanFactory, setPhase, start, startReactively, stop, stopReactively
public TimerTrigger(long period)
period
- the period in millisecondspublic TimerTrigger(long period, int count)
period
- the periodcount
- the countpublic long getPeriod()
public int getCount()
public reactor.core.publisher.Mono<java.lang.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 reactor.core.publisher.Mono<java.lang.Void> doPreStartReactively()
LifecycleObjectSupport
doPreStartReactively
in class LifecycleObjectSupport
protected reactor.core.publisher.Mono<java.lang.Void> doPreStopReactively()
LifecycleObjectSupport
doPreStopReactively
in class LifecycleObjectSupport
public void arm()
Trigger
TriggerListener
may receive events.