Package org.elasticsearch.discovery
Class SeedHostsResolver
- java.lang.Object
-
- org.elasticsearch.common.component.AbstractLifecycleComponent
-
- org.elasticsearch.discovery.SeedHostsResolver
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,LifecycleComponent
,Releasable
,PeerFinder.ConfiguredHostsResolver
public class SeedHostsResolver extends AbstractLifecycleComponent implements PeerFinder.ConfiguredHostsResolver
-
-
Field Summary
Fields Modifier and Type Field Description static Setting<java.lang.Integer>
DISCOVERY_SEED_RESOLVER_MAX_CONCURRENT_RESOLVERS_SETTING
static Setting<TimeValue>
DISCOVERY_SEED_RESOLVER_TIMEOUT_SETTING
static Setting<java.lang.Integer>
LEGACY_DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING
static Setting<TimeValue>
LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT
-
Fields inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
lifecycle
-
-
Constructor Summary
Constructors Constructor Description SeedHostsResolver(java.lang.String nodeName, Settings settings, TransportService transportService, SeedHostsProvider seedProvider)
-
Method Summary
Modifier and Type Method Description protected void
doClose()
protected void
doStart()
protected void
doStop()
static int
getMaxConcurrentResolvers(Settings settings)
static TimeValue
getResolveTimeout(Settings settings)
void
resolveConfiguredHosts(java.util.function.Consumer<java.util.List<TransportAddress>> consumer)
Attempt to resolve the configured unicast hosts list to a list of transport addresses.static java.util.List<TransportAddress>
resolveHostsLists(java.util.concurrent.ExecutorService executorService, org.apache.logging.log4j.Logger logger, java.util.List<java.lang.String> hosts, TransportService transportService, TimeValue resolveTimeout)
Resolves a list of hosts to a list of transport addresses.-
Methods inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stop
-
-
-
-
Field Detail
-
LEGACY_DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING
public static final Setting<java.lang.Integer> LEGACY_DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING
-
LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT
public static final Setting<TimeValue> LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT
-
DISCOVERY_SEED_RESOLVER_MAX_CONCURRENT_RESOLVERS_SETTING
public static final Setting<java.lang.Integer> DISCOVERY_SEED_RESOLVER_MAX_CONCURRENT_RESOLVERS_SETTING
-
-
Constructor Detail
-
SeedHostsResolver
public SeedHostsResolver(java.lang.String nodeName, Settings settings, TransportService transportService, SeedHostsProvider seedProvider)
-
-
Method Detail
-
getMaxConcurrentResolvers
public static int getMaxConcurrentResolvers(Settings settings)
-
resolveHostsLists
public static java.util.List<TransportAddress> resolveHostsLists(java.util.concurrent.ExecutorService executorService, org.apache.logging.log4j.Logger logger, java.util.List<java.lang.String> hosts, TransportService transportService, TimeValue resolveTimeout)
Resolves a list of hosts to a list of transport addresses. Each host is resolved into a transport address (or a collection of addresses if the number of ports is greater than one). Host lookups are done in parallel using specified executor service up to the specified resolve timeout.- Parameters:
executorService
- the executor service used to parallelize hostname lookupslogger
- logger used for logging messages regarding hostname lookupshosts
- the hosts to resolvetransportService
- the transport serviceresolveTimeout
- the timeout before returning from hostname lookups- Returns:
- a list of resolved transport addresses
-
doStart
protected void doStart()
- Specified by:
doStart
in classAbstractLifecycleComponent
-
doStop
protected void doStop()
- Specified by:
doStop
in classAbstractLifecycleComponent
-
doClose
protected void doClose()
- Specified by:
doClose
in classAbstractLifecycleComponent
-
resolveConfiguredHosts
public void resolveConfiguredHosts(java.util.function.Consumer<java.util.List<TransportAddress>> consumer)
Description copied from interface:PeerFinder.ConfiguredHostsResolver
Attempt to resolve the configured unicast hosts list to a list of transport addresses.- Specified by:
resolveConfiguredHosts
in interfacePeerFinder.ConfiguredHostsResolver
- Parameters:
consumer
- Consumer for the resolved list. May not be called if an error occurs or if another resolution attempt is in progress.
-
-