Package org.elasticsearch.discovery.zen
Class NodeJoinController
java.lang.Object
org.elasticsearch.discovery.zen.NodeJoinController
public class NodeJoinController
extends java.lang.Object
This class processes incoming join request (passed zia
ZenDiscovery
). Incoming nodes
are directly added to the cluster state or are accumulated during master election.-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
NodeJoinController.ElectionCallback
-
Constructor Summary
Constructors Constructor Description NodeJoinController(Settings settings, MasterService masterService, AllocationService allocationService, ElectMasterService electMaster, RerouteService rerouteService)
-
Method Summary
Modifier and Type Method Description void
handleJoinRequest(DiscoveryNode node, MembershipAction.JoinCallback callback)
processes or queues an incoming join request.void
startElectionContext()
Accumulates any future incoming join request.void
stopElectionContext(java.lang.String reason)
Stopped accumulating joins.void
waitToBeElectedAsMaster(int requiredMasterJoins, org.elasticsearch.common.unit.TimeValue timeValue, NodeJoinController.ElectionCallback callback)
waits for enough incoming joins from master eligible nodes to complete the master electionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
NodeJoinController
public NodeJoinController(Settings settings, MasterService masterService, AllocationService allocationService, ElectMasterService electMaster, RerouteService rerouteService)
-
-
Method Details
-
waitToBeElectedAsMaster
public void waitToBeElectedAsMaster(int requiredMasterJoins, org.elasticsearch.common.unit.TimeValue timeValue, NodeJoinController.ElectionCallback callback)waits for enough incoming joins from master eligible nodes to complete the master electionYou must start accumulating joins before calling this method. See
startElectionContext()
The method will return once the local node has been elected as master or some failure/timeout has happened. The exact outcome is communicated via the callback parameter, which is guaranteed to be called.
- Parameters:
requiredMasterJoins
- the number of joins from master eligible needed to complete the electiontimeValue
- how long to wait before failing. a timeout is communicated via the callback's onFailure method.callback
- the result of the election (success or failure) will be communicated by calling methods on this object
-
startElectionContext
public void startElectionContext()Accumulates any future incoming join request. Pending join requests will be processed in the final steps of becoming a master or whenstopElectionContext(String)
is called. -
stopElectionContext
public void stopElectionContext(java.lang.String reason)Stopped accumulating joins. All pending joins will be processed. Future joins will be processed immediately -
handleJoinRequest
processes or queues an incoming join request.Note: doesn't do any validation. This should have been done before.
-