org.apache.hadoop.yarn.state
Class StateMachineFactory<OPERAND,STATE extends Enum<STATE>,EVENTTYPE extends Enum<EVENTTYPE>,EVENT>

java.lang.Object
  extended by 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.

@InterfaceAudience.Public
@InterfaceStability.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
StateMachineFactory(STATE defaultInitialState)
          Constructor This is the only constructor in the API.
 
Method Summary
 StateMachineFactory<OPERAND,STATE,EVENTTYPE,EVENT> addTransition(STATE preState, Set<STATE> postStates, EVENTTYPE eventType, MultipleArcTransition<OPERAND,EVENT,STATE> hook)
           
 StateMachineFactory<OPERAND,STATE,EVENTTYPE,EVENT> addTransition(STATE preState, STATE postState, EVENTTYPE eventType)
           
 StateMachineFactory<OPERAND,STATE,EVENTTYPE,EVENT> addTransition(STATE preState, STATE postState, EVENTTYPE eventType, SingleArcTransition<OPERAND,EVENT> hook)
           
 StateMachineFactory<OPERAND,STATE,EVENTTYPE,EVENT> addTransition(STATE preState, STATE postState, Set<EVENTTYPE> eventTypes)
           
 StateMachineFactory<OPERAND,STATE,EVENTTYPE,EVENT> addTransition(STATE preState, STATE postState, Set<EVENTTYPE> eventTypes, SingleArcTransition<OPERAND,EVENT> hook)
           
 org.apache.hadoop.yarn.state.Graph generateStateGraph(String name)
          Generate a graph represents the state graph of this StateMachine
 StateMachineFactory<OPERAND,STATE,EVENTTYPE,EVENT> installTopology()
           
 StateMachine<STATE,EVENTTYPE,EVENT> make(OPERAND operand)
           
 StateMachine<STATE,EVENTTYPE,EVENT> make(OPERAND operand, STATE initialState)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateMachineFactory

public StateMachineFactory(STATE defaultInitialState)
Constructor This is the only constructor in the API.

Method Detail

addTransition

public StateMachineFactory<OPERAND,STATE,EVENTTYPE,EVENT> addTransition(STATE preState,
                                                                        STATE postState,
                                                                        EVENTTYPE eventType)
Parameters:
preState - pre-transition state
postState - post-transition state
eventType - stimulus for the transition
Returns:
a NEW StateMachineFactory just like this with 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,EVENTTYPE,EVENT> addTransition(STATE preState,
                                                                        STATE postState,
                                                                        Set<EVENTTYPE> eventTypes)
Parameters:
preState - pre-transition state
postState - post-transition state
eventTypes - List of stimuli for the transitions
Returns:
a NEW StateMachineFactory just like this with 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,EVENTTYPE,EVENT> addTransition(STATE preState,
                                                                        STATE postState,
                                                                        Set<EVENTTYPE> eventTypes,
                                                                        SingleArcTransition<OPERAND,EVENT> hook)
Parameters:
preState - pre-transition state
postState - post-transition state
eventTypes - List of stimuli for the transitions
hook - transition hook
Returns:
a NEW StateMachineFactory just like this with 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,EVENTTYPE,EVENT> addTransition(STATE preState,
                                                                        STATE postState,
                                                                        EVENTTYPE eventType,
                                                                        SingleArcTransition<OPERAND,EVENT> hook)
Parameters:
preState - pre-transition state
postState - post-transition state
eventType - stimulus for the transition
hook - transition hook
Returns:
a NEW StateMachineFactory just like this with 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,EVENTTYPE,EVENT> addTransition(STATE preState,
                                                                        Set<STATE> postStates,
                                                                        EVENTTYPE eventType,
                                                                        MultipleArcTransition<OPERAND,EVENT,STATE> hook)
Parameters:
preState - pre-transition state
postStates - valid post-transition states
eventType - stimulus for the transition
hook - transition hook
Returns:
a NEW StateMachineFactory just like this with 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

public StateMachineFactory<OPERAND,STATE,EVENTTYPE,EVENT> 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 from this would be by measuring the performance of the derived StateMachine you 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,EVENT> make(OPERAND operand,
                                                STATE initialState)

make

public StateMachine<STATE,EVENTTYPE,EVENT> make(OPERAND operand)

generateStateGraph

public org.apache.hadoop.yarn.state.Graph generateStateGraph(String name)
Generate a graph represents the state graph of this StateMachine

Parameters:
name - graph name
Returns:
Graph object generated


Copyright © 2014 Apache Software Foundation. All Rights Reserved.