|
Sonic Management API | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IStateManager
A concrete implementation of the IStateManager interface acts as a central point for managing the state of an entity, such as the fault tolerant state of the DS or AM.
A concrete state manager implementation is configured with a set.
State controllers (implementers of IStateController) may be registered to effect the behavioral adjustments associated with a particular state transition.
State listeners (implementors of IStateListener) may be added to be informed when a state transitions starts and whether the transition succeeds or fails.
A developer should not attempt to request a state change from either a state controller or a state listener.
Method Summary | |
---|---|
short |
getState(java.lang.Object obj)
Get the state of the specified object. |
void |
registerStateController(IStateController stateController,
short fromState,
short toState,
java.lang.Object obj)
Register a state controller that will cause the behvioral changes associated with the transition from one specified state to another specified state. |
void |
registerStateListener(IStateListener stateListener,
java.lang.Object obj)
Register a listener for the changes in state of the state-managed object. |
boolean |
requestStateChange(short expectedCurrentState,
short desiredState,
java.lang.Object obj)
The thread that detects the condition that requires a state change will call this method to effect the state change. |
Method Detail |
---|
short getState(java.lang.Object obj)
Object
- The object instance whose current state is to be returned.
void registerStateController(IStateController stateController, short fromState, short toState, java.lang.Object obj)
stateController
- The concrete implementation of IStateController that will perform the steps necessary for the state transitionfromState
- The state at which the state-managed entity must be in order for the controller will be invokedtoState
- The state to which the state-managed entity must transition in order for the controller to be invokedobj
- The state-managed object with which the controller is associatedvoid registerStateListener(IStateListener stateListener, java.lang.Object obj)
stateListener
- The concrete implementation of IStateListenerobj
- The state-managed object to which the listener will be associatedboolean requestStateChange(short expectedCurrentState, short desiredState, java.lang.Object obj) throws NonRecoverableStateChangeException, RecoverableStateChangeException
The calling thread is expected to have previously obtained the current state and to have made the decision as to what is the next state that should be applied. To ensure synchronization between calls, the caller is required to provide the expected current state so that it can possibly retry if another thread changed the state between the callers calls. If the current state, from the state manager's perspective, does not match the current state expected by the caller, then a value of "false" should be returned. Likewise, if the transition to the requested desired state from the current state does not represent an allowable transition, then a value of "false" should be returned.
expectedCurrentState
- The current state obtained immediately before calling
this methoddesiredState
- The state the caller wishes to transition toobj
- The state-managed object whose state is to be changed
NonRecoverableStateChangeException
RecoverableStateChangeException
|
Sonic Management API | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |