Module org.elasticsearch.server
Class NodeRemovalClusterStateTaskExecutor
java.lang.Object
org.elasticsearch.cluster.coordination.NodeRemovalClusterStateTaskExecutor
- All Implemented Interfaces:
ClusterStateTaskExecutor<NodeRemovalClusterStateTaskExecutor.Task>
public class NodeRemovalClusterStateTaskExecutor
extends Object
implements ClusterStateTaskExecutor<NodeRemovalClusterStateTaskExecutor.Task>
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.elasticsearch.cluster.ClusterStateTaskExecutor
ClusterStateTaskExecutor.BatchExecutionContext<T extends ClusterStateTaskListener>, ClusterStateTaskExecutor.TaskContext<T extends ClusterStateTaskListener>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexecute
(ClusterStateTaskExecutor.BatchExecutionContext<NodeRemovalClusterStateTaskExecutor.Task> batchExecutionContext) Update the cluster state based on the current state and the given tasks.protected ClusterState
remainingNodesClusterState
(ClusterState currentState, DiscoveryNodes.Builder remainingNodesBuilder) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.cluster.ClusterStateTaskExecutor
clusterStatePublished, describeTasks, runOnlyOnMaster
-
Constructor Details
-
NodeRemovalClusterStateTaskExecutor
-
-
Method Details
-
execute
public ClusterState execute(ClusterStateTaskExecutor.BatchExecutionContext<NodeRemovalClusterStateTaskExecutor.Task> batchExecutionContext) throws Exception Description copied from interface:ClusterStateTaskExecutor
Update the cluster state based on the current state and the given tasks. Return the *same instance* if no update should be published.If this method throws an exception then the cluster state is unchanged and every task's
ClusterStateTaskListener.onFailure(java.lang.Exception)
method is called.A common implementation pattern is to iterate through the tasks, constructing a new and updated
ClusterState
for each one. This works ok but beware that constructing a whole newClusterState
can be somewhat expensive, and there may sometimes be surprisingly many tasks to process in the batch. If it's possible to accumulate the effects of the tasks at a lower level then you should do that instead.- Specified by:
execute
in interfaceClusterStateTaskExecutor<NodeRemovalClusterStateTaskExecutor.Task>
- Returns:
- The resulting cluster state after executing all the tasks. If {code initialState} is returned then no update is published.
- Throws:
Exception
-
remainingNodesClusterState
protected ClusterState remainingNodesClusterState(ClusterState currentState, DiscoveryNodes.Builder remainingNodesBuilder)
-