Class CollectionsRepairEventListener

  • All Implemented Interfaces:
    Closeable, AutoCloseable, ClusterSingleton, ClusterEventListener

    public class CollectionsRepairEventListener
    extends Object
    implements ClusterEventListener, ClusterSingleton, Closeable
    This is an illustration how to re-implement the combination of Solr 8x NodeLostTrigger and AutoAddReplicasPlanAction to maintain the collection's replicas when nodes are lost.

    The notion of waitFor delay between detection and repair action is implemented as a scheduled execution of the repair method, which is called every 1 sec to check whether there are any lost nodes that exceeded their waitFor period.

    NOTE: this functionality would be probably more reliable when executed also as a periodically scheduled check - both as a reactive (listener) and proactive (scheduled) measure.

    • Constructor Detail

      • CollectionsRepairEventListener

        public CollectionsRepairEventListener​(CoreContainer cc)
    • Method Detail

      • setWaitForSecond

        public void setWaitForSecond​(int waitForSecond)
      • onEvent

        public void onEvent​(ClusterEvent event)
        Description copied from interface: ClusterEventListener
        Handle the event. Implementations should be non-blocking - if any long processing is needed it should be performed asynchronously.
        Specified by:
        onEvent in interface ClusterEventListener
        Parameters:
        event - cluster event
      • start

        public void start()
                   throws Exception
        Description copied from interface: ClusterSingleton
        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.
        Specified by:
        start in interface ClusterSingleton
        Throws:
        Exception - on startup errors. The component should revert to the STOPPED state.
      • stop

        public void stop()
        Description copied from interface: ClusterSingleton
        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.
        Specified by:
        stop in interface ClusterSingleton