public class UnicastZenPing extends AbstractComponent implements ZenPing
Modifier and Type | Class and Description |
---|---|
protected class |
UnicastZenPing.PingingRound |
static class |
UnicastZenPing.UnicastPingRequest |
ZenPing.PingCollection, ZenPing.PingResponse
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ACTION_NAME |
static Setting<java.lang.Integer> |
DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING |
static Setting<TimeValue> |
DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT |
static Setting<java.util.List<java.lang.String>> |
DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING |
static int |
LIMIT_FOREIGN_PORTS_COUNT |
static int |
LIMIT_LOCAL_PORTS_COUNT |
protected EsThreadPoolExecutor |
unicastZenPingExecutorService |
deprecationLogger, logger, settings
Constructor and Description |
---|
UnicastZenPing(Settings settings,
ThreadPool threadPool,
TransportService transportService,
UnicastHostsProvider unicastHostsProvider) |
Modifier and Type | Method and Description |
---|---|
void |
clearTemporalResponses()
Clears the list of cached ping responses.
|
void |
close() |
protected void |
finishPingingRound(UnicastZenPing.PingingRound pingingRound) |
protected TransportResponseHandler<org.elasticsearch.discovery.zen.UnicastZenPing.UnicastPingResponse> |
getPingResponseHandler(UnicastZenPing.PingingRound pingingRound,
DiscoveryNode node) |
protected Version |
getVersion() |
void |
ping(java.util.function.Consumer<ZenPing.PingCollection> resultsConsumer,
TimeValue duration)
Sends three rounds of pings notifying the specified
Consumer when pinging is complete. |
protected void |
ping(java.util.function.Consumer<ZenPing.PingCollection> resultsConsumer,
TimeValue scheduleDuration,
TimeValue requestDuration)
a variant of
ping(Consumer, TimeValue) , but allows separating the scheduling duration
from the duration used for request level time outs. |
static java.util.List<DiscoveryNode> |
resolveHostsLists(java.util.concurrent.ExecutorService executorService,
org.apache.logging.log4j.Logger logger,
java.util.List<java.lang.String> hosts,
int limitPortCounts,
TransportService transportService,
java.lang.String nodeId_prefix,
TimeValue resolveTimeout)
Resolves a list of hosts to a list of discovery nodes.
|
protected void |
sendPings(TimeValue timeout,
UnicastZenPing.PingingRound pingingRound) |
void |
start(PingContextProvider contextProvider) |
protected void |
submitToExecutor(AbstractRunnable abstractRunnable) |
logDeprecatedSetting, logRemovedSetting, nodeName
public static final java.lang.String ACTION_NAME
public static final Setting<java.util.List<java.lang.String>> DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING
public static final Setting<java.lang.Integer> DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING
public static final Setting<TimeValue> DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT
public static final int LIMIT_FOREIGN_PORTS_COUNT
public static final int LIMIT_LOCAL_PORTS_COUNT
protected final EsThreadPoolExecutor unicastZenPingExecutorService
public UnicastZenPing(Settings settings, ThreadPool threadPool, TransportService transportService, UnicastHostsProvider unicastHostsProvider)
public static java.util.List<DiscoveryNode> resolveHostsLists(java.util.concurrent.ExecutorService executorService, org.apache.logging.log4j.Logger logger, java.util.List<java.lang.String> hosts, int limitPortCounts, TransportService transportService, java.lang.String nodeId_prefix, TimeValue resolveTimeout) throws java.lang.InterruptedException
executorService
- the executor service used to parallelize hostname lookupslogger
- logger used for logging messages regarding hostname lookupshosts
- the hosts to resolvelimitPortCounts
- the number of ports to resolve (should be 1 for non-local transport)transportService
- the transport servicenodeId_prefix
- a prefix to use for node idsresolveTimeout
- the timeout before returning from hostname lookupsjava.lang.InterruptedException
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface Releasable
public void start(PingContextProvider contextProvider)
public void clearTemporalResponses()
public void ping(java.util.function.Consumer<ZenPing.PingCollection> resultsConsumer, TimeValue duration)
Consumer
when pinging is complete. Pings are sent after resolving
configured unicast hosts to their IP address (subject to DNS caching within the JVM). A batch of pings is sent, then another batch
of pings is sent at half the specified TimeValue
, and then another batch of pings is sent at the specified TimeValue
.
The pings that are sent carry a timeout of 1.25 times the specified TimeValue
. When pinging each node, a connection and
handshake is performed, with a connection timeout of the specified TimeValue
.protected void ping(java.util.function.Consumer<ZenPing.PingCollection> resultsConsumer, TimeValue scheduleDuration, TimeValue requestDuration)
ping(Consumer, TimeValue)
, but allows separating the scheduling duration
from the duration used for request level time outs. This is useful for testingprotected void finishPingingRound(UnicastZenPing.PingingRound pingingRound)
protected void sendPings(TimeValue timeout, UnicastZenPing.PingingRound pingingRound)
protected void submitToExecutor(AbstractRunnable abstractRunnable)
protected TransportResponseHandler<org.elasticsearch.discovery.zen.UnicastZenPing.UnicastPingResponse> getPingResponseHandler(UnicastZenPing.PingingRound pingingRound, DiscoveryNode node)
protected Version getVersion()