Interface ClusterStateTaskListener

All Known Implementing Classes:
AckedClusterStateUpdateTask, ClusterStateUpdateTask, JoinTask, LocalMasterServiceTask, MigrationResultsUpdateTask, NodeRemovalClusterStateTaskExecutor.Task, ShardStateAction.FailedShardUpdateTask, ShardStateAction.StartedShardUpdateTask, SystemIndexMetadataUpgradeService.SystemIndexMetadataUpdateTask

public interface ClusterStateTaskListener
  • Method Details

    • onFailure

      void onFailure(Exception e)
      A callback for when task execution fails. 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.
    • onNoLongerMaster

      default void onNoLongerMaster()
      A callback for when the task was rejected because the processing node is no longer the elected master. 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.
    • clusterStateProcessed

      default void clusterStateProcessed(ClusterState oldState, ClusterState newState)
      Called when the result of the ClusterStateTaskExecutor.execute(ClusterState, List) method have been processed properly by all listeners. The parameter is the state that was ultimately published. This can lead to surprising behaviour if tasks are batched together: a later task in the batch may undo or overwrite the changes made by an earlier task. In general you should prefer to ignore the published state and instead handle the success of a publication via the listener that the executor passes to ClusterStateTaskExecutor.TaskContext.success(org.elasticsearch.action.ActionListener<org.elasticsearch.cluster.ClusterState>). 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.