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 ziaZenDiscovery
). 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)
-
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, TimeValue timeValue, NodeJoinController.ElectionCallback callback)
waits for enough incoming joins from master eligible nodes to complete the master election
-
-
-
Constructor Detail
-
NodeJoinController
public NodeJoinController(Settings settings, MasterService masterService, AllocationService allocationService, ElectMasterService electMaster)
-
-
Method Detail
-
waitToBeElectedAsMaster
public void waitToBeElectedAsMaster(int requiredMasterJoins, 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
public void handleJoinRequest(DiscoveryNode node, MembershipAction.JoinCallback callback)
processes or queues an incoming join request.Note: doesn't do any validation. This should have been done before.
-
-