Module org.elasticsearch.server
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, ClusterState initialState)
extends Record
implements ClusterStateTaskListener
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionJoinTask
(List<JoinTask.NodeJoinTask> nodeJoinTasks, boolean isBecomingMaster, long term, ClusterState initialState) Creates an instance of aJoinTask
record class. -
Method Summary
Modifier and TypeMethodDescriptionalsoRefreshState
(ClusterState latestState) 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.Returns the value of theinitialState
record component.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, TransportVersion transportVersion, JoinReason reason, ActionListener<Void> listener, long term) long
term()
Returns the value of theterm
record component.toString()
Returns a string representation of this record class.
-
Constructor Details
-
JoinTask
public JoinTask(List<JoinTask.NodeJoinTask> nodeJoinTasks, boolean isBecomingMaster, long term, ClusterState initialState) 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 componentinitialState
- the value for theinitialState
record component
-
-
Method Details
-
singleNode
public static JoinTask singleNode(DiscoveryNode node, TransportVersion transportVersion, JoinReason 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. May receive aNotMasterException
if this node stopped being the master before this task was executed or aProcessClusterEventTimeoutException
if the task timed out before it was executed. If the task fails during execution then this method receives the corresponding exception. If the task executes successfully but the resulting cluster state publication fails then this method receives aFailedToCommitClusterStateException
. If publication fails then a new master is elected and the update might or might not take effect, depending on whether or not the newly-elected master accepted the published state that failed to be committed.Use
MasterService.isPublishFailureException(java.lang.Exception)
to detect the "expected" master failure cases if needed.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 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
-
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
-
alsoRefreshState
-
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
-
initialState
Returns the value of theinitialState
record component.- Returns:
- the value of the
initialState
record component
-