- All Implemented Interfaces:
- Direct Known Subclasses:
public abstract class ClusterStateUpdateTask extends Object implements ClusterStateTaskConfig, ClusterStateTaskExecutor<ClusterStateUpdateTask>, ClusterStateTaskListener
A task that can update the cluster state.
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.cluster.ClusterStateTaskConfig
Method SummaryModifier and TypeMethodDescription
final voidCallback invoked after new cluster state is published.Builds a concise description of a list of tasks (to be used in logging etc.).
abstract ClusterStateUpdate the cluster state based on the current state.Update the cluster state based on the current state and the given tasks.
abstract voidA callback for when task execution fails.
final booleanMarked as final as cluster state update tasks should only run on master.
timeout()If the cluster state update task wasn't processed by the provided timeout, call
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
executepublic final ClusterStateTaskExecutor.ClusterTasksResult<ClusterStateUpdateTask> execute
(ClusterState currentState, List<ClusterStateUpdateTask> tasks) throws ExceptionUpdate the cluster state based on the current state and the given tasks. Return the *same instance* if no state should be changed.
describeTasksBuilds a concise description of a list of tasks (to be used in logging etc.). Note that the tasks given are not necessarily the same as those that will be passed to
ClusterStateTaskExecutor.execute(ClusterState, List). but are guaranteed to be a subset of them. This method can be called multiple times with different lists before execution. This allows groupd task description but the submitting source.
executeUpdate the cluster state based on the current state. Return the *same instance* if no state should be changed.
onFailureA callback for when task execution fails. Implementations of this callback should not throw exceptions: an exception thrown here is logged by the master service at
ERRORlevel and otherwise ignored. If log-and-ignore is the right behaviour then implementations should do so themselves, typically using a more specific logger and at a less dramatic log level.
clusterStatePublishedpublic final void clusterStatePublished
(ClusterStatePublicationEvent clusterStatePublicationEvent)Callback 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.
timeoutIf the cluster state update task wasn't processed by the provided timeout, call
ClusterStateTaskListener.onFailure(String, Exception). May return null to indicate no timeout is needed (default).
prioritypublic final Priority priority()Description copied from interface:
runOnlyOnMasterpublic final boolean runOnlyOnMaster()Marked as final as cluster state update tasks should only run on master. For local requests, use