Class ClusterStateUpdateTask

java.lang.Object
org.elasticsearch.cluster.ClusterStateUpdateTask
All Implemented Interfaces:
ClusterStateTaskListener
Direct Known Subclasses:
AckedClusterStateUpdateTask, MigrationResultsUpdateTask, SystemIndexMetadataUpgradeService.SystemIndexMetadataUpdateTask

public abstract class ClusterStateUpdateTask extends Object implements ClusterStateTaskListener
A task that can update the cluster state.
  • Constructor Details

    • ClusterStateUpdateTask

      public ClusterStateUpdateTask()
    • ClusterStateUpdateTask

      public ClusterStateUpdateTask(Priority priority)
    • ClusterStateUpdateTask

      public ClusterStateUpdateTask(TimeValue timeout)
    • ClusterStateUpdateTask

      public ClusterStateUpdateTask(Priority priority, TimeValue timeout)
  • Method Details

    • execute

      public abstract ClusterState execute(ClusterState currentState) throws Exception
      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

      public void clusterStateProcessed(ClusterState initialState, ClusterState newState)
      Called when the result of the execute(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 at ERROR level and otherwise ignored, except in tests where it raises an AssertionError. 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

      @Nullable public final TimeValue timeout()
      If the cluster state update task wasn't processed by the provided timeout, call ClusterStateTaskListener.onFailure(Exception). May return null to indicate no timeout is needed (default).
    • priority

      public final Priority priority()