Record Class ReservedStateUpdateTaskExecutor

java.lang.Object
java.lang.Record
org.elasticsearch.reservedstate.service.ReservedStateUpdateTaskExecutor
Record Components:
rerouteService - instance of RerouteService, so that we can execute reroute after cluster state is published
All Implemented Interfaces:
ClusterStateTaskExecutor<ReservedStateUpdateTask>

public record ReservedStateUpdateTaskExecutor(RerouteService rerouteService) extends Record implements ClusterStateTaskExecutor<ReservedStateUpdateTask>
Reserved cluster state update task executor
  • Constructor Details

    • ReservedStateUpdateTaskExecutor

      public ReservedStateUpdateTaskExecutor(RerouteService rerouteService)
      Creates an instance of a ReservedStateUpdateTaskExecutor record class.
      Parameters:
      rerouteService - the value for the rerouteService record component
  • Method Details

    • execute

      Description copied from interface: ClusterStateTaskExecutor
      Update 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 ClusterState for each one. This works ok but beware that constructing a whole new ClusterState can 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:
      execute in interface ClusterStateTaskExecutor<ReservedStateUpdateTask>
      Returns:
      The resulting cluster state after executing all the tasks. If {code initialState} is returned then no update is published.
      Throws:
      Exception
    • clusterStatePublished

      public void clusterStatePublished(ClusterState newClusterState)
      Description copied from interface: ClusterStateTaskExecutor
      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.
      Specified by:
      clusterStatePublished in interface ClusterStateTaskExecutor<ReservedStateUpdateTask>
      Parameters:
      newClusterState - The new state which was published.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • rerouteService

      public RerouteService rerouteService()
      Returns the value of the rerouteService record component.
      Returns:
      the value of the rerouteService record component