@InterfaceAudience.Public @InterfaceStability.Evolving public class ServiceStateModel extends Object
コンストラクタと説明 |
---|
ServiceStateModel(String name)
Create the service state model in the
Service.STATE.NOTINITED
state. |
ServiceStateModel(String name,
org.apache.hadoop.service.Service.STATE state)
Create a service state model instance in the chosen state
|
修飾子とタイプ | メソッドと説明 |
---|---|
static void |
checkStateTransition(String name,
org.apache.hadoop.service.Service.STATE state,
org.apache.hadoop.service.Service.STATE proposed)
Check that a state tansition is valid and
throw an exception if not
|
void |
ensureCurrentState(org.apache.hadoop.service.Service.STATE expectedState)
Verify that that a service is in a given state.
|
org.apache.hadoop.service.Service.STATE |
enterState(org.apache.hadoop.service.Service.STATE proposed)
Enter a state -thread safe.
|
org.apache.hadoop.service.Service.STATE |
getState()
Query the service state.
|
boolean |
isInState(org.apache.hadoop.service.Service.STATE proposed)
Query that the state is in a specific state
|
static boolean |
isValidStateTransition(org.apache.hadoop.service.Service.STATE current,
org.apache.hadoop.service.Service.STATE proposed)
Is a state transition valid?
|
String |
toString()
return the state text as the toString() value
|
public ServiceStateModel(String name)
Service.STATE.NOTINITED
state.public ServiceStateModel(String name, org.apache.hadoop.service.Service.STATE state)
state
- the starting statepublic org.apache.hadoop.service.Service.STATE getState()
public boolean isInState(org.apache.hadoop.service.Service.STATE proposed)
proposed
- proposed new statepublic void ensureCurrentState(org.apache.hadoop.service.Service.STATE expectedState)
expectedState
- the desired stateServiceStateException
- if the service state is different from
the desired statepublic org.apache.hadoop.service.Service.STATE enterState(org.apache.hadoop.service.Service.STATE proposed)
proposed
- proposed new stateServiceStateException
- if the transition is not permittedpublic static void checkStateTransition(String name, org.apache.hadoop.service.Service.STATE state, org.apache.hadoop.service.Service.STATE proposed)
name
- name of the service (can be null)state
- current stateproposed
- proposed new statepublic static boolean isValidStateTransition(org.apache.hadoop.service.Service.STATE current, org.apache.hadoop.service.Service.STATE proposed)
current
- current stateproposed
- proposed new stateCopyright © 2016 Apache Software Foundation. All rights reserved.