Package org.elasticsearch.discovery.zen
Class NodeJoinController
java.lang.Object
org.elasticsearch.discovery.zen.NodeJoinController
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
-
Constructor Summary
ConstructorDescriptionNodeJoinController(Settings settings, MasterService masterService, AllocationService allocationService, ElectMasterService electMaster, RerouteService rerouteService)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
handleJoinRequest(DiscoveryNode node, MembershipAction.JoinCallback callback)
processes or queues an incoming join request.void
Accumulates any future incoming join request.void
stopElectionContext(String reason)
Stopped accumulating joins.void
waitToBeElectedAsMaster(int requiredMasterJoins, org.elasticsearch.core.TimeValue timeValue, NodeJoinController.ElectionCallback callback)
waits for enough incoming joins from master eligible nodes to complete the master election
-
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.core.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
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.
-