Class CollectionsRepairEventListener
- java.lang.Object
-
- org.apache.solr.cluster.events.impl.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
waitFordelay 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 theirwaitForperiod.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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.solr.cloud.ClusterSingleton
ClusterSingleton.State
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_WAIT_FOR_SECstatic StringPLUGIN_NAME
-
Constructor Summary
Constructors Constructor Description CollectionsRepairEventListener(CoreContainer cc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()StringgetName()Unique name of this singleton.ClusterSingleton.StategetState()Returns the current state of the component.voidonEvent(ClusterEvent event)Handle the event.voidsetWaitForSecond(int waitForSecond)voidstart()Start the operation of the component.voidstop()Stop the operation of the component.
-
-
-
Field Detail
-
PLUGIN_NAME
public static final String PLUGIN_NAME
- See Also:
- Constant Field Values
-
DEFAULT_WAIT_FOR_SEC
public static final int DEFAULT_WAIT_FOR_SEC
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CollectionsRepairEventListener
public CollectionsRepairEventListener(CoreContainer cc)
-
-
Method Detail
-
setWaitForSecond
public void setWaitForSecond(int waitForSecond)
-
getName
public String getName()
Description copied from interface:ClusterSingletonUnique name of this singleton. Used for registration.- Specified by:
getNamein interfaceClusterSingleton
-
onEvent
public void onEvent(ClusterEvent event)
Description copied from interface:ClusterEventListenerHandle the event. Implementations should be non-blocking - if any long processing is needed it should be performed asynchronously.- Specified by:
onEventin interfaceClusterEventListener- Parameters:
event- cluster event
-
start
public void start() throws ExceptionDescription copied from interface:ClusterSingletonStart 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:
startin interfaceClusterSingleton- Throws:
Exception- on startup errors. The component should revert to the STOPPED state.
-
getState
public ClusterSingleton.State getState()
Description copied from interface:ClusterSingletonReturns the current state of the component.- Specified by:
getStatein interfaceClusterSingleton
-
stop
public void stop()
Description copied from interface:ClusterSingletonStop 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:
stopin interfaceClusterSingleton
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-