Module org.elasticsearch.server
Record Class ReservedStateUpdateTaskExecutor
java.lang.Object
java.lang.Record
org.elasticsearch.reservedstate.service.ReservedStateUpdateTaskExecutor
- Record Components:
rerouteService
- instance ofRerouteService
, 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
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.cluster.ClusterStateTaskExecutor
ClusterStateTaskExecutor.BatchExecutionContext<T extends ClusterStateTaskListener>, ClusterStateTaskExecutor.TaskContext<T extends ClusterStateTaskListener>
-
Constructor Summary
ConstructorDescriptionReservedStateUpdateTaskExecutor
(RerouteService rerouteService) Creates an instance of aReservedStateUpdateTaskExecutor
record class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clusterStatePublished
(ClusterState newClusterState) Callback invoked after new cluster state is published.final boolean
Indicates whether some other object is "equal to" this one.execute
(ClusterStateTaskExecutor.BatchExecutionContext<ReservedStateUpdateTask> batchExecutionContext) Update the cluster state based on the current state and the given tasks.final int
hashCode()
Returns a hash code value for this object.Returns the value of thererouteService
record component.final String
toString()
Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.cluster.ClusterStateTaskExecutor
describeTasks, runOnlyOnMaster
-
Constructor Details
-
ReservedStateUpdateTaskExecutor
Creates an instance of aReservedStateUpdateTaskExecutor
record class.- Parameters:
rerouteService
- the value for thererouteService
record component
-
-
Method Details
-
execute
public ClusterState execute(ClusterStateTaskExecutor.BatchExecutionContext<ReservedStateUpdateTask> batchExecutionContext) throws Exception 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 newClusterState
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 interfaceClusterStateTaskExecutor<ReservedStateUpdateTask>
- Returns:
- The resulting cluster state after executing all the tasks. If {code initialState} is returned then no update is published.
- Throws:
Exception
-
clusterStatePublished
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 interfaceClusterStateTaskExecutor<ReservedStateUpdateTask>
- Parameters:
newClusterState
- The new state which was published.
-
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. -
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. -
equals
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 withObjects::equals(Object,Object)
. -
rerouteService
Returns the value of thererouteService
record component.- Returns:
- the value of the
rerouteService
record component
-