|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.hadoop.service.ServiceStateModel
@InterfaceAudience.Public @InterfaceStability.Evolving public class ServiceStateModel
Implements the service state model.
Constructor Summary | |
---|---|
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 |
Method Summary | |
---|---|
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? There are no checks for current==proposed as that is considered a non-transition. |
String |
toString()
return the state text as the toString() value |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ServiceStateModel(String name)
Service.STATE.NOTINITED
state.
public ServiceStateModel(String name, org.apache.hadoop.service.Service.STATE state)
state
- the starting stateMethod Detail |
---|
public org.apache.hadoop.service.Service.STATE getState()
public boolean isInState(org.apache.hadoop.service.Service.STATE proposed)
proposed
- proposed new state
public void ensureCurrentState(org.apache.hadoop.service.Service.STATE expectedState)
expectedState
- the desired state
ServiceStateException
- 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 state
ServiceStateException
- 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 state
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |