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)
extends Record
implements ClusterStateTaskListener
- 
Nested Class SummaryNested Classes
- 
Constructor SummaryConstructorsConstructorDescriptionJoinTask(List<JoinTask.NodeJoinTask> nodeJoinTasks, boolean isBecomingMaster, long term) Creates an instance of aJoinTaskrecord class.
- 
Method SummaryModifier 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.
- 
Constructor Details- 
JoinTaskCreates an instance of aJoinTaskrecord class.- Parameters:
- nodeJoinTasks- the value for the- nodeJoinTasksrecord component
- isBecomingMaster- the value for the- isBecomingMasterrecord component
- term- the value for the- termrecord component
 
 
- 
- 
Method Details- 
singleNodepublic static JoinTask singleNode(DiscoveryNode node, String reason, ActionListener<Void> listener, long term) 
- 
completingElectionpublic static JoinTask completingElection(Stream<JoinTask.NodeJoinTask> nodeJoinTaskStream, long term) 
- 
nodeCountpublic int nodeCount()
- 
onFailureDescription 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 interface- ClusterStateTaskListener
 
- 
clusterStateProcessedDescription 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(java.lang.Runnable). 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 interface- ClusterStateTaskListener
 
- 
toStringReturns 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
- 
hashCodepublic 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.
- 
equalsIndicates 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 '=='.
- 
nodeJoinTasksReturns the value of thenodeJoinTasksrecord component.- Returns:
- the value of the nodeJoinTasksrecord component
 
- 
isBecomingMasterpublic boolean isBecomingMaster()Returns the value of theisBecomingMasterrecord component.- Returns:
- the value of the isBecomingMasterrecord component
 
- 
termpublic long term()Returns the value of thetermrecord component.- Returns:
- the value of the termrecord component
 
 
-