Class Coordinator
java.lang.Object
org.elasticsearch.common.component.AbstractLifecycleComponent
org.elasticsearch.cluster.coordination.Coordinator
- All Implemented Interfaces:
Closeable,AutoCloseable,ClusterStatePublisher,LifecycleComponent,org.elasticsearch.core.Releasable,Discovery
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.elasticsearch.cluster.coordination.ClusterStatePublisher
ClusterStatePublisher.AckListener -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Setting<org.elasticsearch.core.TimeValue>static Setting<org.elasticsearch.core.TimeValue>static longFields inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
lifecycle -
Constructor Summary
ConstructorsConstructorDescriptionCoordinator(String nodeName, Settings settings, ClusterSettings clusterSettings, TransportService transportService, NamedWriteableRegistry namedWriteableRegistry, AllocationService allocationService, MasterService masterService, Supplier<CoordinationState.PersistedState> persistedStateSupplier, SeedHostsProvider seedHostsProvider, ClusterApplier clusterApplier, Collection<BiConsumer<DiscoveryNode,ClusterState>> onJoinValidators, Random random, RerouteService rerouteService, ElectionStrategy electionStrategy, NodeHealthService nodeHealthService) -
Method Summary
Modifier and TypeMethodDescriptionstatic Settings.BuilderaddZen1Attribute(boolean isZen1Node, Settings.Builder builder)protected voiddoClose()protected voiddoStart()protected voiddoStop()voidbooleanstatic booleanisZen1Node(DiscoveryNode discoveryNode)voidpublish(ClusterChangedEvent clusterChangedEvent, ActionListener<Void> publishListener, ClusterStatePublisher.AckListener ackListener)Publish all the changes to the cluster from the master (can be called just by the master).booleansetInitialConfiguration(CoordinationMetadata.VotingConfiguration votingConfiguration)Sets the initial configuration to the givenCoordinationMetadata.VotingConfiguration.voidTriggers the first join cyclestats()Methods inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.common.component.LifecycleComponent
addLifecycleListener, lifecycleState, removeLifecycleListener, start, stopMethods inherited from interface org.elasticsearch.core.Releasable
close
-
Field Details
-
ZEN1_BWC_TERM
public static final long ZEN1_BWC_TERM- See Also:
- Constant Field Values
-
PUBLISH_INFO_TIMEOUT_SETTING
-
PUBLISH_TIMEOUT_SETTING
-
-
Constructor Details
-
Coordinator
public Coordinator(String nodeName, Settings settings, ClusterSettings clusterSettings, TransportService transportService, NamedWriteableRegistry namedWriteableRegistry, AllocationService allocationService, MasterService masterService, Supplier<CoordinationState.PersistedState> persistedStateSupplier, SeedHostsProvider seedHostsProvider, ClusterApplier clusterApplier, Collection<BiConsumer<DiscoveryNode,ClusterState>> onJoinValidators, Random random, RerouteService rerouteService, ElectionStrategy electionStrategy, NodeHealthService nodeHealthService)- Parameters:
nodeName- The name of the node, used to name theExecutorServiceof theSeedHostsResolver.onJoinValidators- A collection of join validators to restrict which nodes may join the cluster.
-
-
Method Details
-
doStart
protected void doStart()- Specified by:
doStartin classAbstractLifecycleComponent
-
stats
-
startInitialJoin
public void startInitialJoin()Description copied from interface:DiscoveryTriggers the first join cycle- Specified by:
startInitialJoinin interfaceDiscovery
-
doStop
protected void doStop()- Specified by:
doStopin classAbstractLifecycleComponent
-
doClose
- Specified by:
doClosein classAbstractLifecycleComponent- Throws:
IOException
-
invariant
public void invariant() -
isInitialConfigurationSet
public boolean isInitialConfigurationSet() -
setInitialConfiguration
public boolean setInitialConfiguration(CoordinationMetadata.VotingConfiguration votingConfiguration)Sets the initial configuration to the givenCoordinationMetadata.VotingConfiguration. This method is safe to call more than once, as long as the argument to each call is the same.- Parameters:
votingConfiguration- The nodes that should form the initial configuration.- Returns:
- whether this call successfully set the initial configuration - if false, the cluster has already been bootstrapped.
-
getLastAcceptedState
-
getApplierState
-
publish
public void publish(ClusterChangedEvent clusterChangedEvent, ActionListener<Void> publishListener, ClusterStatePublisher.AckListener ackListener)Description copied from interface:ClusterStatePublisherPublish all the changes to the cluster from the master (can be called just by the master). The publish process should apply this state to the master as well! The publishListener allows to wait for the publication to complete, which can be either successful completion, timing out or failing. The method is guaranteed to pass back aFailedToCommitClusterStateExceptionto the publishListener if the change is not committed and should be rejected. Any other exception signals that something bad happened but the change is committed. TheClusterStatePublisher.AckListenerallows to keep track of the ack received from nodes, and verify whether they updated their own cluster state or not.- Specified by:
publishin interfaceClusterStatePublisher
-
getOnJoinValidators
-
getFoundPeers
-
addZen1Attribute
-
isZen1Node
-