Package org.elasticsearch.discovery.zen
Class NodeJoinController
- java.lang.Object
-
- org.elasticsearch.common.component.AbstractComponent
-
- org.elasticsearch.discovery.zen.NodeJoinController
-
public class NodeJoinController extends AbstractComponent
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
static class
NodeJoinController.JoinTaskExecutor
-
Field Summary
Fields Modifier and Type Field Description static DiscoveryNode
BECOME_MASTER_TASK
a task indicated that the current node should become master, if no current master is knownstatic DiscoveryNode
FINISH_ELECTION_TASK
a task that is used to signal the election is stopped and we should process pending joins.-
Fields inherited from class org.elasticsearch.common.component.AbstractComponent
deprecationLogger, logger, settings
-
-
Constructor Summary
Constructors Constructor Description NodeJoinController(MasterService masterService, AllocationService allocationService, ElectMasterService electMaster, Settings settings)
-
Method Summary
All Methods Instance Methods Concrete Methods 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-
Methods inherited from class org.elasticsearch.common.component.AbstractComponent
logDeprecatedSetting, logRemovedSetting, nodeName
-
-
-
-
Field Detail
-
BECOME_MASTER_TASK
public static final DiscoveryNode BECOME_MASTER_TASK
a task indicated that the current node should become master, if no current master is known
-
FINISH_ELECTION_TASK
public static final DiscoveryNode FINISH_ELECTION_TASK
a task that is used to signal the election is stopped and we should process pending joins. it may be use in combination withBECOME_MASTER_TASK
-
-
Constructor Detail
-
NodeJoinController
public NodeJoinController(MasterService masterService, AllocationService allocationService, ElectMasterService electMaster, Settings settings)
-
-
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.
-
-