Class StateMachine
java.lang.Object
org.apache.mina.statemachine.StateMachine
Represents a complete state machine. Contains a collection of
State
objects connected by Transitions. Normally you wouldn't create
instances of this class directly but rather use the
State annotation to define
your states and then let StateMachineFactory create a
StateMachine for you.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate final ThreadLocal<LinkedList<Event>> private static final org.slf4j.Loggerprivate final ThreadLocal<Boolean> private final State -
Constructor Summary
ConstructorsConstructorDescriptionStateMachine(Collection<State> states, String startStateId) Creates a new instance using the specifiedStates and start state.StateMachine(State[] states, String startStateId) Creates a new instance using the specifiedStates and start state. -
Method Summary
Modifier and TypeMethodDescription(package private) voidexecuteOnEntries(StateContext context, State state) (package private) voidexecuteOnExits(StateContext context, State state) getCallStack(StateContext context) Returns theStatewith the specified id.voidProcesses the specifiedEventthrough thisStateMachine.private voidprivate voidprocessEvents(LinkedList<Event> eventQueue) private voidsetCurrentState(StateContext context, State newState)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
CALL_STACK
-
startState
-
states
-
processingThreadLocal
-
eventQueueThreadLocal
-
-
Constructor Details
-
StateMachine
-
StateMachine
-
-
Method Details
-
getState
-
getStates
- Returns:
- an unmodifiable
Collectionof allStates used by thisStateMachine.
-
handle
Processes the specifiedEventthrough thisStateMachine. Normally you wouldn't call this directly but rather useStateMachineProxyBuilderto create a proxy for an interface of your choice. Any method calls on the proxy will be translated intoEventobjects and then fed to theStateMachineby the proxy using this method.- Parameters:
event- theEventto be handled.
-
processEvents
-
handle
-
getCallStack
-
setCurrentState
-
executeOnExits
-
executeOnEntries
-