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
ConstructorDescriptionDefaultStateMachineService
(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 void
destroy()
protected void
doStop()
protected StateMachine<S,
E> handleStart
(StateMachine<S, E> stateMachine, boolean start) protected StateMachine<S,
E> handleStop
(StateMachine<S, E> stateMachine, boolean stop) boolean
hasStateMachine
(String machineId) Determines if the given machine identifier denotes a known managed state machine.void
releaseStateMachine
(String machineId) Release the state machine.void
releaseStateMachine
(String machineId, boolean stop) Release state machine.protected StateMachine<S,
E> restoreStateMachine
(StateMachine<S, E> stateMachine, StateMachineContext<S, E> stateMachineContext) void
setStateMachinePersist
(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:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
- Throws:
Exception
-
acquireStateMachine
Description copied from interface:StateMachineService
Acquires the state machine. Machine from this method is returned started.- Specified by:
acquireStateMachine
in interfaceStateMachineService<S,
E> - Parameters:
machineId
- the machine id- Returns:
- the state machine
- See Also:
-
acquireStateMachine
Description copied from interface:StateMachineService
Acquires the state machine.- Specified by:
acquireStateMachine
in interfaceStateMachineService<S,
E> - Parameters:
machineId
- the machine idstart
- indicating if machine should be returned started- Returns:
- the state machine
-
releaseStateMachine
Description copied from interface:StateMachineService
Release the state machine. Machine with this method is stopped.- Specified by:
releaseStateMachine
in interfaceStateMachineService<S,
E> - Parameters:
machineId
- the machine id- See Also:
-
releaseStateMachine
Description copied from interface:StateMachineService
Release state machine.- Specified by:
releaseStateMachine
in 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
-