Class DefaultStateMachineService<S,E>
java.lang.Object
org.springframework.statemachine.service.DefaultStateMachineService<S,E>
- Type Parameters:
S- the type of stateE- the type of event
- All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean,StateMachineService<S,E>
public class DefaultStateMachineService<S,E>
extends Object
implements StateMachineService<S,E>, org.springframework.beans.factory.DisposableBean
Default implementation of a
StateMachineService.-
Constructor Summary
ConstructorsConstructorDescriptionDefaultStateMachineService(StateMachineFactory<S, E> stateMachineFactory) Instantiates a new default state machine service.DefaultStateMachineService(StateMachineFactory<S, E> stateMachineFactory, StateMachinePersist<S, E, String> stateMachinePersist) Instantiates a new default state machine service. -
Method Summary
Modifier and TypeMethodDescriptionacquireStateMachine(String machineId) Acquires the state machine.acquireStateMachine(String machineId, boolean start) Acquires the state machine.final voiddestroy()protected voiddoStop()protected StateMachine<S,E> handleStart(StateMachine<S, E> stateMachine, boolean start) protected StateMachine<S,E> handleStop(StateMachine<S, E> stateMachine, boolean stop) booleanhasStateMachine(String machineId) Determines if the given machine identifier denotes a known managed state machine.voidreleaseStateMachine(String machineId) Release the state machine.voidreleaseStateMachine(String machineId, boolean stop) Release state machine.protected StateMachine<S,E> restoreStateMachine(StateMachine<S, E> stateMachine, StateMachineContext<S, E> stateMachineContext) voidsetStateMachinePersist(StateMachinePersist<S, E, String> stateMachinePersist) Sets the state machine persist.
-
Constructor Details
-
DefaultStateMachineService
Instantiates a new default state machine service.- Parameters:
stateMachineFactory- the state machine factory
-
DefaultStateMachineService
public DefaultStateMachineService(StateMachineFactory<S, E> stateMachineFactory, StateMachinePersist<S, E, String> stateMachinePersist) Instantiates a new default state machine service.- Parameters:
stateMachineFactory- the state machine factorystateMachinePersist- the state machine persist
-
-
Method Details
-
destroy
- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean- Throws:
Exception
-
acquireStateMachine
Description copied from interface:StateMachineServiceAcquires the state machine. Machine from this method is returned started.- Specified by:
acquireStateMachinein interfaceStateMachineService<S,E> - Parameters:
machineId- the machine id- Returns:
- the state machine
- See Also:
-
acquireStateMachine
Description copied from interface:StateMachineServiceAcquires the state machine.- Specified by:
acquireStateMachinein interfaceStateMachineService<S,E> - Parameters:
machineId- the machine idstart- indicating if machine should be returned started- Returns:
- the state machine
-
releaseStateMachine
Description copied from interface:StateMachineServiceRelease the state machine. Machine with this method is stopped.- Specified by:
releaseStateMachinein interfaceStateMachineService<S,E> - Parameters:
machineId- the machine id- See Also:
-
releaseStateMachine
Description copied from interface:StateMachineServiceRelease state machine.- Specified by:
releaseStateMachinein interfaceStateMachineService<S,E> - Parameters:
machineId- the machine idstop- indicating if machine should be stopped
-
hasStateMachine
Determines if the given machine identifier denotes a known managed state machine.- Parameters:
machineId- machine identifier- Returns:
- true if machineId denotes a known managed state machine currently in memory
-
setStateMachinePersist
Sets the state machine persist.- Parameters:
stateMachinePersist- the state machine persist
-
doStop
protected void doStop() -
restoreStateMachine
protected StateMachine<S,E> restoreStateMachine(StateMachine<S, E> stateMachine, StateMachineContext<S, E> stateMachineContext) -
handleStart
-
handleStop
-