- All Known Subinterfaces:
- All Known Implementing Classes:
public interface ClusterSingletonIntended for components that should be enabled only one instance per cluster.
Components that implement this interface are always in one of these states:
- STOPPED - the default state. The component is idle and does not perform any functions. It should also avoid holding any resources.
- STARTING - transitional state, which leads either to RUNNING or STOPPING in case of startup failures.
- STOPPING - transitional state, which leads to STOPPED state.
- RUNNING - the component is active.
Components must be prepared to change these states multiple times in their life-cycle.
Implementation detail: currently these components are instantiated on all nodes but they are started only on the Overseer leader, and stopped when the current node loses its Overseer leadership.
Nested Class Summary
Nested Classes Modifier and Type Interface Description
All Methods Instance Methods Abstract Methods Modifier and Type Method Description
getName()Unique name of this singleton.
getState()Returns the current state of the component.
start()Start the operation of the component.
stop()Stop the operation of the component.
String getName()Unique name of this singleton. Used for registration.
void start() throws ExceptionStart the operation of the component. Initially this method should set the state to STARTING, and on success it should set the state to RUNNING.
Exception- on startup errors. The component should revert to the STOPPED state.
ClusterSingleton.State getState()Returns the current state of the component.
void stop()Stop the operation of the component. Initially this method should set the state to STOPPING, and on return it should set the state to STOPPED. Components should also avoid holding any resource when in STOPPED state.