java.lang.Object
org.elasticsearch.cluster.ClusterStateUpdateTask
- All Implemented Interfaces:
ClusterStateTaskListener
- Direct Known Subclasses:
AckedClusterStateUpdateTask
A task that can update the cluster state.
-
Constructor Summary
ConstructorsConstructorDescriptionClusterStateUpdateTask
(Priority priority) ClusterStateUpdateTask
(Priority priority, TimeValue timeout) ClusterStateUpdateTask
(TimeValue timeout) -
Method Summary
Modifier and TypeMethodDescriptionvoid
clusterStateProcessed
(ClusterState initialState, ClusterState newState) Called when the result of theexecute(org.elasticsearch.cluster.ClusterState)
method has been processed properly by all listeners.abstract ClusterState
execute
(ClusterState currentState) Computes the cluster state that results from executing this task on the given state.final Priority
priority()
final TimeValue
timeout()
If the cluster state update task wasn't processed by the provided timeout, callClusterStateTaskListener.onFailure(Exception)
.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.ClusterStateTaskListener
onFailure
-
Constructor Details
-
ClusterStateUpdateTask
public ClusterStateUpdateTask() -
ClusterStateUpdateTask
-
ClusterStateUpdateTask
-
ClusterStateUpdateTask
-
-
Method Details
-
execute
Computes the cluster state that results from executing this task on the given state. Returns the *same instance* if no change is required, which is an important and valuable optimisation since it short-circuits the whole publication process and saves a bunch of time and effort.- Throws:
Exception
-
clusterStateProcessed
Called when the result of theexecute(org.elasticsearch.cluster.ClusterState)
method has been processed properly by all listeners. The parameter is the state that was ultimately published. Implementations of this callback must not throw exceptions: an exception thrown here is logged by the master service atERROR
level and otherwise ignored, except in tests where it raises anAssertionError
. If log-and-ignore is the right behaviour then implementations must do so themselves, typically using a more specific logger and at a less dramatic log level. -
timeout
If the cluster state update task wasn't processed by the provided timeout, callClusterStateTaskListener.onFailure(Exception)
. May return null to indicate no timeout is needed (default). -
priority
-