Interface ClusterSingleton

All Known Subinterfaces:
ClusterEventProducer
All Known Implementing Classes:
ClusterEventProducerBase, ClusterEventProducerFactory, CollectionsRepairEventListener, DefaultClusterEventProducer, DelegatingClusterEventProducer, InactiveShardRemover, NoOpProducer

public interface ClusterSingleton
Intended 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
    static enum 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Unique name of this singleton.
    Returns the current state of the component.
    void
    Start the operation of the component.
    void
    Stop the operation of the component.
  • Method Details

    • getName

      String getName()
      Unique name of this singleton. Used for registration.
    • start

      void start() throws Exception
      Start the operation of the component. Initially this method should set the state to STARTING, and on success it should set the state to RUNNING.
      Throws:
      Exception - on startup errors. The component should revert to the STOPPED state.
    • getState

      Returns the current state of the component.
    • stop

      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.