Class ClusterApplierService
java.lang.Object
org.elasticsearch.common.component.AbstractLifecycleComponent
org.elasticsearch.cluster.service.ClusterApplierService
- All Implemented Interfaces:
Closeable,AutoCloseable,ClusterApplier,LifecycleComponent,org.elasticsearch.core.Releasable
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.cluster.service.ClusterApplier
ClusterApplier.ClusterApplyListener -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Setting<org.elasticsearch.core.TimeValue>static Stringprotected ThreadPoolFields inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
lifecycle -
Constructor Summary
ConstructorsConstructorDescriptionClusterApplierService(String nodeName, Settings settings, ClusterSettings clusterSettings, ThreadPool threadPool) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a high priority applier of updated cluster states.voidaddListener(ClusterStateListener listener)Add a listener for updated cluster statesvoidAdd a listener for on/off local node master eventsvoidaddLowPriorityApplier(ClusterStateApplier applier)Adds an applier which will be called after all high priority and normal appliers have been called.voidaddStateApplier(ClusterStateApplier applier)Adds a applier of updated cluster states.voidaddTimeoutListener(org.elasticsearch.core.TimeValue timeout, TimeoutClusterStateListener listener)Adds a cluster state listener that is expected to be removed during a short period of time.protected booleanstatic booleanasserts that the current thread is NOT the cluster state update threadprotected voidconnectToNodesAndWait(ClusterState newClusterState)protected PrioritizedEsThreadPoolExecutorprotected longprotected voiddoClose()protected voiddoStart()protected voiddoStop()voidonNewClusterState(String source, Supplier<ClusterState> clusterStateSupplier, ClusterApplier.ClusterApplyListener listener)Method to invoke when a new cluster state is available to be appliedvoidremoveApplier(ClusterStateApplier applier)Removes an applier of updated cluster states.voidremoveListener(ClusterStateListener listener)Removes a listener for updated cluster states.voidRemoves a timeout listener for updated cluster states.voidrunOnApplierThread(String source, Consumer<ClusterState> clusterStateConsumer, ClusterApplier.ClusterApplyListener listener)voidrunOnApplierThread(String source, Consumer<ClusterState> clusterStateConsumer, ClusterApplier.ClusterApplyListener listener, Priority priority)voidsetInitialState(ClusterState initialState)Sets the initial state for this applier.voidsetNodeConnectionsService(NodeConnectionsService nodeConnectionsService)state()The current cluster state.Methods inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stop
-
Field Details
-
CLUSTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING
public static final Setting<org.elasticsearch.core.TimeValue> CLUSTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING -
CLUSTER_UPDATE_THREAD_NAME
- See Also:
- Constant Field Values
-
threadPool
-
-
Constructor Details
-
ClusterApplierService
public ClusterApplierService(String nodeName, Settings settings, ClusterSettings clusterSettings, ThreadPool threadPool)
-
-
Method Details
-
setNodeConnectionsService
-
setInitialState
Description copied from interface:ClusterApplierSets the initial state for this applier. Should only be called once.- Specified by:
setInitialStatein interfaceClusterApplier- Parameters:
initialState- the initial state to set
-
doStart
protected void doStart()- Specified by:
doStartin classAbstractLifecycleComponent
-
createThreadPoolExecutor
-
doStop
protected void doStop()- Specified by:
doStopin classAbstractLifecycleComponent
-
doClose
protected void doClose()- Specified by:
doClosein classAbstractLifecycleComponent
-
state
The current cluster state. Should be renamed to appliedClusterState -
addHighPriorityApplier
Adds a high priority applier of updated cluster states. -
addLowPriorityApplier
Adds an applier which will be called after all high priority and normal appliers have been called. -
addStateApplier
Adds a applier of updated cluster states. -
removeApplier
Removes an applier of updated cluster states. -
addListener
Add a listener for updated cluster states -
removeListener
Removes a listener for updated cluster states. -
removeTimeoutListener
Removes a timeout listener for updated cluster states. -
addLocalNodeMasterListener
Add a listener for on/off local node master events -
addTimeoutListener
public void addTimeoutListener(@Nullable org.elasticsearch.core.TimeValue timeout, TimeoutClusterStateListener listener)Adds a cluster state listener that is expected to be removed during a short period of time. If provided, the listener will be notified once a specific time has elapsed. NOTE: the listener is not removed on timeout. This is the responsibility of the caller. -
runOnApplierThread
public void runOnApplierThread(String source, Consumer<ClusterState> clusterStateConsumer, ClusterApplier.ClusterApplyListener listener, Priority priority) -
runOnApplierThread
public void runOnApplierThread(String source, Consumer<ClusterState> clusterStateConsumer, ClusterApplier.ClusterApplyListener listener) -
threadPool
-
onNewClusterState
public void onNewClusterState(String source, Supplier<ClusterState> clusterStateSupplier, ClusterApplier.ClusterApplyListener listener)Description copied from interface:ClusterApplierMethod to invoke when a new cluster state is available to be applied- Specified by:
onNewClusterStatein interfaceClusterApplier- Parameters:
source- information where the cluster state came fromclusterStateSupplier- the cluster state supplier which provides the latest cluster state to applylistener- callback that is invoked after cluster state is applied
-
assertNotClusterStateUpdateThread
asserts that the current thread is NOT the cluster state update thread -
connectToNodesAndWait
-
currentTimeInMillis
protected long currentTimeInMillis() -
applicationMayFail
protected boolean applicationMayFail()
-