Package org.oddjob.state
Enum Class ServiceState
- All Implemented Interfaces:
Serializable,Comparable<ServiceState>,Constable,State
Encapsulate the allowed states for a service.
- Author:
- Rob Gordon
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe service has been destroyed.Indicates an exception has occurred.Indicates the service is starting.The service can be started.Indicates the service has started and is now available to service requests.Indicates the service is starting.The service is stopped. -
Method Summary
Modifier and TypeMethodDescriptionstatic ServiceStateUtility function to convert a state text to to the JobState.static ServiceStateReturns the enum constant of this class with the specified name.static ServiceState[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfMethods inherited from interface org.oddjob.state.State
isComplete, isDestroyed, isException, isExecuting, isIncomplete, isReady, isStoppable
-
Enum Constant Details
-
STARTABLE
The service can be started.Note that this state is needed in addition to
STOPPEDto tie in with state transitions of job states. Without this state, anEXCEPTIONstate would reset toSTOPPEDwhich could cause a parent sequence to complete which would be counter intuitive compared to the behaviour of job states. -
STARTING
Indicates the service is starting. The execution thread is still in the start method. -
INITIALISING
Indicates the service is starting. The execution thread is not in the start method. Used by asynchronous services where initialisation is done on a separate thread. -
STARTED
Indicates the service has started and is now available to service requests. -
STOPPED
The service is stopped. -
EXCEPTION
Indicates an exception has occurred. This is generally when trying to start the service. But may also happen at other times. -
DESTROYED
The service has been destroyed. It can no longer be used.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
stateFor
Utility function to convert a state text to to the JobState.- Parameters:
state- Case insensitive text.- Returns:
- The corresponding jobState or null if it's invalid.
-