S
- the type of stateE
- the type of eventT
- the type of persister context objectpublic abstract class AbstractPersistingStateMachineInterceptor<S,E,T> extends StateMachineInterceptorAdapter<S,E> implements StateMachinePersist<S,E,T>
StateMachineInterceptor
persisting StateMachineContext
s.
This class is to be used as a base implementation which wants to persist a machine which
is about to kept running as normal use case for persistence is to stop machine, persist and
then start it again.Constructor and Description |
---|
AbstractPersistingStateMachineInterceptor() |
Modifier and Type | Method and Description |
---|---|
protected StateMachineContext<S,E> |
buildStateMachineContext(StateMachine<S,E> stateMachine,
State<S,E> state)
Builds the state machine context.
|
void |
postStateChange(State<S,E> state,
org.springframework.messaging.Message<E> message,
Transition<S,E> transition,
StateMachine<S,E> stateMachine)
Called after a state change.
|
void |
preStateChange(State<S,E> state,
org.springframework.messaging.Message<E> message,
Transition<S,E> transition,
StateMachine<S,E> stateMachine)
Called prior of a state change.
|
abstract StateMachineContext<S,E> |
read(T contextObj)
Read
StateMachineContext from persistent store. |
void |
setExtendedStateVariablesFunction(Function<StateMachine<S,E>,java.util.Map<java.lang.Object,java.lang.Object>> extendedStateVariablesFunction)
Sets the function creating extended state variables.
|
abstract void |
write(StateMachineContext<S,E> context,
T contextObj)
Write
StateMachineContext into persistent store. |
postTransition, preEvent, preTransition, stateMachineError
public AbstractPersistingStateMachineInterceptor()
public void preStateChange(State<S,E> state, org.springframework.messaging.Message<E> message, Transition<S,E> transition, StateMachine<S,E> stateMachine)
StateMachineInterceptor
preStateChange
in interface StateMachineInterceptor<S,E>
preStateChange
in class StateMachineInterceptorAdapter<S,E>
state
- the statemessage
- the messagetransition
- the transitionstateMachine
- the state machinepublic void postStateChange(State<S,E> state, org.springframework.messaging.Message<E> message, Transition<S,E> transition, StateMachine<S,E> stateMachine)
StateMachineInterceptor
postStateChange
in interface StateMachineInterceptor<S,E>
postStateChange
in class StateMachineInterceptorAdapter<S,E>
state
- the statemessage
- the messagetransition
- the transitionstateMachine
- the state machinepublic abstract void write(StateMachineContext<S,E> context, T contextObj) throws java.lang.Exception
StateMachineContext
into persistent store.write
in interface StateMachinePersist<S,E,T>
context
- the state machine contextcontextObj
- the context objectjava.lang.Exception
- the exceptionpublic abstract StateMachineContext<S,E> read(T contextObj) throws java.lang.Exception
StateMachineContext
from persistent store.read
in interface StateMachinePersist<S,E,T>
contextObj
- the context objectjava.lang.Exception
- the exceptionpublic void setExtendedStateVariablesFunction(Function<StateMachine<S,E>,java.util.Map<java.lang.Object,java.lang.Object>> extendedStateVariablesFunction)
extendedStateVariablesFunction
- the extended state variables functionprotected StateMachineContext<S,E> buildStateMachineContext(StateMachine<S,E> stateMachine, State<S,E> state)
stateMachine
- the state machinestate
- the state