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
-
Constructor Summary
ConstructorDescriptionJoinTask
(List<JoinTask.NodeJoinTask> nodeJoinTasks, boolean isBecomingMaster, long term) Creates an instance of aJoinTask
record class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clusterStateProcessed
(ClusterState oldState, ClusterState newState) Called when the result of theClusterStateTaskExecutor.execute(ClusterState, List)
method have been processed properly by all listeners.static JoinTask
completingElection
(Stream<JoinTask.NodeJoinTask> nodeJoinTaskStream, long term) final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
Returns the value of theisBecomingMaster
record component.int
Returns the value of thenodeJoinTasks
record component.nodes()
void
A callback for when task execution fails.static JoinTask
singleNode
(DiscoveryNode node, String reason, ActionListener<Void> listener, long term) long
term()
Returns the value of theterm
record component.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.ClusterStateTaskListener
onNoLongerMaster
-
Constructor Details
-
JoinTask
Creates an instance of aJoinTask
record class.- Parameters:
nodeJoinTasks
- the value for thenodeJoinTasks
record componentisBecomingMaster
- the value for theisBecomingMaster
record componentterm
- the value for theterm
record 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:ClusterStateTaskListener
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 atERROR
level 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:
onFailure
in interfaceClusterStateTaskListener
-
clusterStateProcessed
Description copied from interface:ClusterStateTaskListener
Called 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 atERROR
level 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:
clusterStateProcessed
in 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 thenodeJoinTasks
record component.- Returns:
- the value of the
nodeJoinTasks
record component
-
isBecomingMaster
public boolean isBecomingMaster()Returns the value of theisBecomingMaster
record component.- Returns:
- the value of the
isBecomingMaster
record component
-
term
public long term()Returns the value of theterm
record component.- Returns:
- the value of the
term
record component
-