Class ShardStateAction.ShardStartedClusterStateTaskExecutor
java.lang.Object
org.elasticsearch.cluster.action.shard.ShardStateAction.ShardStartedClusterStateTaskExecutor
- All Implemented Interfaces:
ClusterStateTaskExecutor<ShardStateAction.StartedShardUpdateTask>
- Enclosing class:
- ShardStateAction
public static class ShardStateAction.ShardStartedClusterStateTaskExecutor
extends Object
implements ClusterStateTaskExecutor<ShardStateAction.StartedShardUpdateTask>
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.cluster.ClusterStateTaskExecutor
ClusterStateTaskExecutor.LegacyClusterTaskResultActionListener, ClusterStateTaskExecutor.SuccessIgnoringPublishListener, ClusterStateTaskExecutor.TaskContext<T extends ClusterStateTaskListener> -
Constructor Summary
ConstructorsConstructorDescriptionShardStartedClusterStateTaskExecutor(AllocationService allocationService, RerouteService rerouteService) -
Method Summary
Modifier and TypeMethodDescriptionvoidclusterStatePublished(ClusterState newClusterState) Callback invoked after new cluster state is published.execute(ClusterState currentState, List<ClusterStateTaskExecutor.TaskContext<ShardStateAction.StartedShardUpdateTask>> taskContexts) Update the cluster state based on the current state and the given tasks.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.cluster.ClusterStateTaskExecutor
describeTasks, runOnlyOnMaster
-
Constructor Details
-
ShardStartedClusterStateTaskExecutor
public ShardStartedClusterStateTaskExecutor(AllocationService allocationService, RerouteService rerouteService)
-
-
Method Details
-
execute
public ClusterState execute(ClusterState currentState, List<ClusterStateTaskExecutor.TaskContext<ShardStateAction.StartedShardUpdateTask>> taskContexts) throws Exception Description copied from interface:ClusterStateTaskExecutorUpdate 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
ClusterStatefor each one. This works ok but beware that constructing a whole newClusterStatecan 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:
executein interfaceClusterStateTaskExecutor<ShardStateAction.StartedShardUpdateTask>- Parameters:
currentState- The initial cluster state on which the tasks should be executed.taskContexts- AClusterStateTaskExecutor.TaskContextfor each task in the batch. Implementations must complete every context in the list.- Returns:
- The resulting cluster state after executing all the tasks. If {code currentState} is returned then no update is published.
- Throws:
Exception
-
clusterStatePublished
Description copied from interface:ClusterStateTaskExecutorCallback invoked after new cluster state is published. Note that this method is not invoked if the cluster state was not updated. Note that this method will be executed using system context.- Specified by:
clusterStatePublishedin interfaceClusterStateTaskExecutor<ShardStateAction.StartedShardUpdateTask>- Parameters:
newClusterState- The new state which was published.
-