Package org.elasticsearch.discovery
Class SeedHostsResolver
java.lang.Object
org.elasticsearch.common.component.AbstractLifecycleComponent
org.elasticsearch.discovery.SeedHostsResolver
- All Implemented Interfaces:
Closeable,AutoCloseable,LifecycleComponent,Releasable,ConfiguredHostsResolver
public class SeedHostsResolver
extends AbstractLifecycleComponent
implements ConfiguredHostsResolver
-
Field Summary
FieldsModifier and TypeFieldDescriptionFields inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
lifecycle -
Constructor Summary
ConstructorsConstructorDescriptionSeedHostsResolver(String nodeName, Settings settings, TransportService transportService, SeedHostsProvider seedProvider) -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoClose()protected voiddoStart()protected voiddoStop()static intgetMaxConcurrentResolvers(Settings settings) static TimeValuegetResolveTimeout(Settings settings) voidresolveConfiguredHosts(Consumer<List<TransportAddress>> consumer) Attempt to resolve the configured hosts list to a list of transport addresses.static List<TransportAddress>resolveHostsLists(CancellableThreads cancellableThreads, ExecutorService executorService, org.apache.logging.log4j.Logger logger, List<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 Details
-
LEGACY_DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING
-
LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT
-
DISCOVERY_SEED_RESOLVER_MAX_CONCURRENT_RESOLVERS_SETTING
-
DISCOVERY_SEED_RESOLVER_TIMEOUT_SETTING
-
-
Constructor Details
-
SeedHostsResolver
public SeedHostsResolver(String nodeName, Settings settings, TransportService transportService, SeedHostsProvider seedProvider)
-
-
Method Details
-
getMaxConcurrentResolvers
-
getResolveTimeout
-
resolveHostsLists
public static List<TransportAddress> resolveHostsLists(CancellableThreads cancellableThreads, ExecutorService executorService, org.apache.logging.log4j.Logger logger, List<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:
doStartin classAbstractLifecycleComponent
-
doStop
protected void doStop()- Specified by:
doStopin classAbstractLifecycleComponent
-
doClose
protected void doClose()- Specified by:
doClosein classAbstractLifecycleComponent
-
resolveConfiguredHosts
Description copied from interface:ConfiguredHostsResolverAttempt to resolve the configured hosts list to a list of transport addresses.- Specified by:
resolveConfiguredHostsin interfaceConfiguredHostsResolver- Parameters:
consumer- Consumer for the resolved list. May not be called if an error occurs or if another resolution attempt is in progress.
-