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 aJoinTaskrecord class. -
Method Summary
Modifier and TypeMethodDescriptionalsoRefreshState(ClusterState latestState) 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.Returns the value of theinitialStaterecord component.booleanReturns the value of theisBecomingMasterrecord component.intReturns the value of thenodeJoinTasksrecord component.nodes()voidA callback for when task execution fails.static JoinTasksingleNode(DiscoveryNode node, CompatibilityVersions compatibilityVersions, Set<String> features, JoinReason reason, ActionListener<Void> listener, long term) longterm()Returns the value of thetermrecord 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 aJoinTaskrecord class.- Parameters:
nodeJoinTasks- the value for thenodeJoinTasksrecord componentisBecomingMaster- the value for theisBecomingMasterrecord componentterm- the value for thetermrecord componentinitialState- the value for theinitialStaterecord component
-
-
Method Details
-
singleNode
public static JoinTask singleNode(DiscoveryNode node, CompatibilityVersions compatibilityVersions, Set<String> features, 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:ClusterStateTaskListenerA callback for when task execution fails. May receive aNotMasterExceptionif this node stopped being the master before this task was executed or aProcessClusterEventTimeoutExceptionif 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
ERRORlevel 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
-
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 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
-
initialState
Returns the value of theinitialStaterecord component.- Returns:
- the value of the
initialStaterecord component
-