Package org.elasticsearch.discovery
Class PeerFinder
java.lang.Object
org.elasticsearch.discovery.PeerFinder
public abstract class PeerFinder
extends java.lang.Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
PeerFinder.ConfiguredHostsResolver
static interface
PeerFinder.TransportAddressConnector
-
Field Summary
Fields Modifier and Type Field Description static Setting<TimeValue>
DISCOVERY_FIND_PEERS_INTERVAL_SETTING
static Setting<TimeValue>
DISCOVERY_REQUEST_PEERS_TIMEOUT_SETTING
static java.lang.String
REQUEST_PEERS_ACTION_NAME
-
Constructor Summary
Constructors Constructor Description PeerFinder(Settings settings, TransportService transportService, PeerFinder.TransportAddressConnector transportAddressConnector, PeerFinder.ConfiguredHostsResolver configuredHostsResolver)
-
Method Summary
Modifier and Type Method Description void
activate(DiscoveryNodes lastAcceptedNodes)
void
deactivate(DiscoveryNode leader)
long
getCurrentTerm()
java.lang.Iterable<DiscoveryNode>
getFoundPeers()
java.util.List<TransportAddress>
getLastResolvedAddresses()
java.util.Optional<DiscoveryNode>
getLeader()
protected boolean
holdsLock()
protected abstract void
onActiveMasterFound(DiscoveryNode masterNode, long term)
Invoked on receipt of a PeersResponse from a node that believes it's an active leader, which this node should therefore try and join.protected abstract void
onFoundPeersUpdated()
Invoked when the set of found peers changes.void
setCurrentTerm(long currentTerm)
protected void
startProbe(TransportAddress transportAddress)
-
Field Details
-
REQUEST_PEERS_ACTION_NAME
public static final java.lang.String REQUEST_PEERS_ACTION_NAME- See Also:
- Constant Field Values
-
DISCOVERY_FIND_PEERS_INTERVAL_SETTING
-
DISCOVERY_REQUEST_PEERS_TIMEOUT_SETTING
-
-
Constructor Details
-
PeerFinder
public PeerFinder(Settings settings, TransportService transportService, PeerFinder.TransportAddressConnector transportAddressConnector, PeerFinder.ConfiguredHostsResolver configuredHostsResolver)
-
-
Method Details
-
activate
-
deactivate
-
holdsLock
protected final boolean holdsLock() -
getLeader
-
getCurrentTerm
public long getCurrentTerm() -
setCurrentTerm
public void setCurrentTerm(long currentTerm) -
onActiveMasterFound
Invoked on receipt of a PeersResponse from a node that believes it's an active leader, which this node should therefore try and join. Note that invocations of this method are not synchronised. By the time it is called we may have been deactivated. -
onFoundPeersUpdated
protected abstract void onFoundPeersUpdated()Invoked when the set of found peers changes. Note that invocations of this method are not fully synchronised, so we only guarantee that the change to the set of found peers happens before this method is invoked. If there are multiple concurrent changes then there will be multiple concurrent invocations of this method, with no guarantee as to their order. For this reason we do not pass the updated set of peers as an argument to this method, leaving it to the implementation to call getFoundPeers() with appropriate synchronisation to avoid lost updates. Also, by the time this method is invoked we may have been deactivated. -
getLastResolvedAddresses
-
getFoundPeers
-
startProbe
-