S
- the type of stateE
- the type of eventpublic class DefaultStateMachineExecutor<S,E> extends LifecycleObjectSupport implements StateMachineExecutor<S,E>
StateMachineExecutor
.StateMachineExecutor.StateMachineExecutorTransit<S,E>
Constructor and Description |
---|
DefaultStateMachineExecutor(StateMachine<S,E> stateMachine,
StateMachine<S,E> relayStateMachine,
java.util.Collection<Transition<S,E>> transitions,
java.util.Map<Trigger<S,E>,Transition<S,E>> triggerToTransitionMap,
java.util.List<Transition<S,E>> triggerlessTransitions,
Transition<S,E> initialTransition,
org.springframework.messaging.Message<E> initialEvent,
TransitionConflictPolicy transitionConflictPolicy)
Instantiates a new default state machine executor.
|
Modifier and Type | Method and Description |
---|---|
void |
addStateMachineInterceptor(StateMachineInterceptor<S,E> interceptor)
Adds the state machine interceptor.
|
protected void |
doStart()
Subclasses may implement this method with the start behavior.
|
protected void |
doStop()
Subclasses may implement this method with the stop behavior.
|
void |
execute()
Execute
StateMachineExecutor logic. |
void |
executeTriggerlessTransitions(StateContext<S,E> context,
State<S,E> state)
Execute and check all triggerless transitions.
|
java.util.concurrent.locks.Lock |
getLock()
Gets the execution lock.
|
void |
queueDeferredEvent(org.springframework.messaging.Message<E> message)
Queue deferred event.
|
void |
queueEvent(org.springframework.messaging.Message<E> message)
Queue event.
|
void |
queueTrigger(Trigger<S,E> trigger,
org.springframework.messaging.Message<E> message)
Queue trigger.
|
void |
setForwardedInitialEvent(org.springframework.messaging.Message<E> message)
Set initial forwarded event.
|
void |
setInitialEnabled(boolean enabled)
Sets the if initial stage is enabled.
|
void |
setStateMachineExecutorTransit(StateMachineExecutor.StateMachineExecutorTransit<S,E> stateMachineExecutorTransit)
Sets the state machine executor transit.
|
afterPropertiesSet, destroy, doDestroy, getBeanFactory, getPhase, getTaskExecutor, getTaskScheduler, isAutoStartup, isRunning, onInit, setAutoStartup, setBeanFactory, setPhase, setTaskExecutor, setTaskScheduler, start, stop, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
start, stop
public DefaultStateMachineExecutor(StateMachine<S,E> stateMachine, StateMachine<S,E> relayStateMachine, java.util.Collection<Transition<S,E>> transitions, java.util.Map<Trigger<S,E>,Transition<S,E>> triggerToTransitionMap, java.util.List<Transition<S,E>> triggerlessTransitions, Transition<S,E> initialTransition, org.springframework.messaging.Message<E> initialEvent, TransitionConflictPolicy transitionConflictPolicy)
stateMachine
- the state machinerelayStateMachine
- the relay state machinetransitions
- the transitionstriggerToTransitionMap
- the trigger to transition maptriggerlessTransitions
- the triggerless transitionsinitialTransition
- the initial transitioninitialEvent
- the initial eventtransitionConflictPolicy
- the transition conflict policypublic void queueEvent(org.springframework.messaging.Message<E> message)
StateMachineExecutor
queueEvent
in interface StateMachineExecutor<S,E>
message
- the messagepublic void queueTrigger(Trigger<S,E> trigger, org.springframework.messaging.Message<E> message)
StateMachineExecutor
queueTrigger
in interface StateMachineExecutor<S,E>
trigger
- the triggermessage
- the messagepublic void queueDeferredEvent(org.springframework.messaging.Message<E> message)
StateMachineExecutor
queueDeferredEvent
in interface StateMachineExecutor<S,E>
message
- the messagepublic void execute()
StateMachineExecutor
StateMachineExecutor
logic.execute
in interface StateMachineExecutor<S,E>
public void setStateMachineExecutorTransit(StateMachineExecutor.StateMachineExecutorTransit<S,E> stateMachineExecutorTransit)
StateMachineExecutor
setStateMachineExecutorTransit
in interface StateMachineExecutor<S,E>
stateMachineExecutorTransit
- the state machine executor transitprotected void doStart()
LifecycleObjectSupport
LifecycleObjectSupport.lifecycleLock
.doStart
in class LifecycleObjectSupport
protected void doStop()
LifecycleObjectSupport
LifecycleObjectSupport.lifecycleLock
.doStop
in class LifecycleObjectSupport
public void setInitialEnabled(boolean enabled)
StateMachineExecutor
setInitialEnabled
in interface StateMachineExecutor<S,E>
enabled
- the new flagpublic void setForwardedInitialEvent(org.springframework.messaging.Message<E> message)
StateMachineExecutor
setForwardedInitialEvent
in interface StateMachineExecutor<S,E>
message
- the forwarded messageStateMachineAccess.setForwardedInitialEvent(Message)
public void addStateMachineInterceptor(StateMachineInterceptor<S,E> interceptor)
StateMachineExecutor
addStateMachineInterceptor
in interface StateMachineExecutor<S,E>
interceptor
- the interceptorpublic java.util.concurrent.locks.Lock getLock()
StateMachineExecutor
getLock
in interface StateMachineExecutor<S,E>
public void executeTriggerlessTransitions(StateContext<S,E> context, State<S,E> state)
StateMachineExecutor
executeTriggerlessTransitions
in interface StateMachineExecutor<S,E>
context
- the state contextstate
- the state