Package org.apache.hadoop.yarn.state
Class StateMachineFactory<OPERAND,STATE extends Enum<STATE>,EVENTTYPE extends Enum<EVENTTYPE>,EVENT>
java.lang.Object
org.apache.hadoop.yarn.state.StateMachineFactory<OPERAND,STATE,EVENTTYPE,EVENT>
- Type Parameters:
OPERAND- The object type on which this state machine operates.STATE- The state of the entity.EVENTTYPE- The external eventType to be handled.EVENT- The event object.
@Public
@Evolving
public final class StateMachineFactory<OPERAND,STATE extends Enum<STATE>,EVENTTYPE extends Enum<EVENTTYPE>,EVENT>
extends Object
State machine topology.
This object is semantically immutable. If you have a
StateMachineFactory there's no operation in the API that changes
its semantic properties.
-
Constructor Summary
ConstructorsConstructorDescriptionStateMachineFactory(STATE defaultInitialState) Constructor This is the only constructor in the API. -
Method Summary
Modifier and TypeMethodDescriptionaddTransition(STATE preState, Set<STATE> postStates, EVENTTYPE eventType, MultipleArcTransition<OPERAND, EVENT, STATE> hook) addTransition(STATE preState, STATE postState, EVENTTYPE eventType) addTransition(STATE preState, STATE postState, EVENTTYPE eventType, SingleArcTransition<OPERAND, EVENT> hook) addTransition(STATE preState, STATE postState, Set<EVENTTYPE> eventTypes) addTransition(STATE preState, STATE postState, Set<EVENTTYPE> eventTypes, SingleArcTransition<OPERAND, EVENT> hook) org.apache.hadoop.yarn.state.GraphgenerateStateGraph(String name) Generate a graph represents the state graph of this StateMachineA StateMachine that accepts a transition listener.
-
Constructor Details
-
StateMachineFactory
Constructor This is the only constructor in the API.- Parameters:
defaultInitialState- default initial state.
-
-
Method Details
-
addTransition
public StateMachineFactory<OPERAND,STATE, addTransitionEVENTTYPE, EVENT> (STATE preState, STATE postState, EVENTTYPE eventType) - Parameters:
preState- pre-transition statepostState- post-transition stateeventType- stimulus for the transition- Returns:
- a NEW StateMachineFactory just like
thiswith the current transition added as a new legal transition. This overload has no hook object. Note that the returned StateMachineFactory is a distinct object. This method is part of the API.
-
addTransition
public StateMachineFactory<OPERAND,STATE, addTransitionEVENTTYPE, EVENT> (STATE preState, STATE postState, Set<EVENTTYPE> eventTypes) - Parameters:
preState- pre-transition statepostState- post-transition stateeventTypes- List of stimuli for the transitions- Returns:
- a NEW StateMachineFactory just like
thiswith the current transition added as a new legal transition. This overload has no hook object. Note that the returned StateMachineFactory is a distinct object. This method is part of the API.
-
addTransition
public StateMachineFactory<OPERAND,STATE, addTransitionEVENTTYPE, EVENT> (STATE preState, STATE postState, Set<EVENTTYPE> eventTypes, SingleArcTransition<OPERAND, EVENT> hook) - Parameters:
preState- pre-transition statepostState- post-transition stateeventTypes- List of stimuli for the transitionshook- transition hook- Returns:
- a NEW StateMachineFactory just like
thiswith the current transition added as a new legal transition Note that the returned StateMachineFactory is a distinct object. This method is part of the API.
-
addTransition
public StateMachineFactory<OPERAND,STATE, addTransitionEVENTTYPE, EVENT> (STATE preState, STATE postState, EVENTTYPE eventType, SingleArcTransition<OPERAND, EVENT> hook) - Parameters:
preState- pre-transition statepostState- post-transition stateeventType- stimulus for the transitionhook- transition hook- Returns:
- a NEW StateMachineFactory just like
thiswith the current transition added as a new legal transition Note that the returned StateMachineFactory is a distinct object. This method is part of the API.
-
addTransition
public StateMachineFactory<OPERAND,STATE, addTransitionEVENTTYPE, EVENT> (STATE preState, Set<STATE> postStates, EVENTTYPE eventType, MultipleArcTransition<OPERAND, EVENT, STATE> hook) - Parameters:
preState- pre-transition statepostStates- valid post-transition stateseventType- stimulus for the transitionhook- transition hook- Returns:
- a NEW StateMachineFactory just like
thiswith the current transition added as a new legal transition Note that the returned StateMachineFactory is a distinct object. This method is part of the API.
-
installTopology
- Returns:
- a StateMachineFactory just like
this, except that if you won't need any synchronization to build a state machine Note that the returned StateMachineFactory is a distinct object. This method is part of the API. The only way you could distinguish the returned StateMachineFactory fromthiswould be by measuring the performance of the derivedStateMachineyou can get from it. Calling this is optional. It doesn't change the semantics of the factory, if you call it then when you use the factory there is no synchronization.
-
make
public StateMachine<STATE,EVENTTYPE, makeEVENT> (OPERAND operand, STATE initialState, StateTransitionListener<OPERAND, EVENT, STATE> listener) A StateMachine that accepts a transition listener.- Parameters:
operand- the object upon which the returnedStateMachinewill operate.initialState- the state in which the returnedStateMachinewill start.listener- An implementation of aStateTransitionListener.- Returns:
- A (@link StateMachine}.
-
make
-
make
-
generateStateGraph
Generate a graph represents the state graph of this StateMachine- Parameters:
name- graph name- Returns:
- Graph object generated
-