Record Class JoinTask
java.lang.Object
java.lang.Record
org.elasticsearch.cluster.coordination.JoinTask
- All Implemented Interfaces:
ClusterStateTaskListener
public record JoinTask(List<JoinTask.NodeJoinTask> nodeJoinTasks, boolean isBecomingMaster, long term)
extends Record
implements ClusterStateTaskListener
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionJoinTask(List<JoinTask.NodeJoinTask> nodeJoinTasks, boolean isBecomingMaster, long term) Creates an instance of aJoinTaskrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidclusterStateProcessed(ClusterState oldState, ClusterState newState) Called when the result of theClusterStateTaskExecutor.execute(ClusterState, List)method have been processed properly by all listeners.static JoinTaskcompletingElection(Stream<JoinTask.NodeJoinTask> nodeJoinTaskStream, long term) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theisBecomingMasterrecord component.intReturns the value of thenodeJoinTasksrecord component.nodes()voidA callback for when task execution fails.static JoinTasksingleNode(DiscoveryNode node, String reason, ActionListener<Void> listener, long term) longterm()Returns the value of thetermrecord component.toString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.cluster.ClusterStateTaskListener
onNoLongerMaster
-
Constructor Details
-
JoinTask
Creates an instance of aJoinTaskrecord class.- Parameters:
nodeJoinTasks- the value for thenodeJoinTasksrecord componentisBecomingMaster- the value for theisBecomingMasterrecord componentterm- the value for thetermrecord component
-
-
Method Details
-
singleNode
public static JoinTask singleNode(DiscoveryNode node, String reason, ActionListener<Void> listener, long term) -
completingElection
public static JoinTask completingElection(Stream<JoinTask.NodeJoinTask> nodeJoinTaskStream, long term) -
nodeCount
public int nodeCount() -
onFailure
Description copied from interface:ClusterStateTaskListenerA callback for when task execution fails. Implementations of this callback must not throw exceptions: an exception thrown here is logged by the master service atERRORlevel 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.- Specified by:
onFailurein interfaceClusterStateTaskListener
-
clusterStateProcessed
Description copied from interface:ClusterStateTaskListenerCalled when the result of theClusterStateTaskExecutor.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 toClusterStateTaskExecutor.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 atERRORlevel 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.- Specified by:
clusterStateProcessedin interfaceClusterStateTaskListener
-
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. -
nodes
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
nodeJoinTasks
Returns the value of thenodeJoinTasksrecord component.- Returns:
- the value of the
nodeJoinTasksrecord component
-
isBecomingMaster
public boolean isBecomingMaster()Returns the value of theisBecomingMasterrecord component.- Returns:
- the value of the
isBecomingMasterrecord component
-
term
public long term()Returns the value of thetermrecord component.- Returns:
- the value of the
termrecord component
-