Interface ClusterSingleton

  • All Known Subinterfaces:
    ClusterEventProducer
    All Known Implementing Classes:
    ClusterEventProducerBase, ClusterEventProducerFactory, CollectionsRepairEventListener, DefaultClusterEventProducer, DelegatingClusterEventProducer, 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.

    • Method Detail

      • 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.
      • 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.