Class DnsResolverPool
java.lang.Object
org.graylog2.lookup.adapters.dnslookup.DnsResolverPool
Manages a pool of Netty
Since the source port for DNS resolution requests is fixed for the duration of the resolver lifecycle, the pooling capability of this class allows the source address to by varied for each request by choosing a random resolver from the pool for each request.
The resolvers in the pool are periodically refreshed to cycle in new source ports for subsequent requests.
The pool size and refresh interval are configurable globally for all DNS Lookup adapters with the following Graylog server configuration properties (the defaults are indicated below as well).
Callers can use the
DnsNameResolverFactory
objects.
Since the source port for DNS resolution requests is fixed for the duration of the resolver lifecycle, the pooling capability of this class allows the source address to by varied for each request by choosing a random resolver from the pool for each request.
The resolvers in the pool are periodically refreshed to cycle in new source ports for subsequent requests.
The pool size and refresh interval are configurable globally for all DNS Lookup adapters with the following Graylog server configuration properties (the defaults are indicated below as well).
dns_lookup_adapter_resolver_pool_size = 10 dns_lookup_adapter_resolver_pool_refresh_interval = 300s
Callers can use the
takeLease()
method to acquire a lease for a resolver.
The DnsResolverPool.ResolverLease.release()
method must be called to release a resolver lease after use.
These operations are thread-safe.-
Nested Class Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
DnsResolverPool
(String dnsServerIps, long queryTimeout, long poolSize, long poolRefreshSeconds) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected boolean
protected int
poolSize()
protected int
Allows for a random resolver to be returned for each request.protected void
void
stop()
protected DnsResolverPool.ResolverLease
-
Constructor Details
-
DnsResolverPool
protected DnsResolverPool(String dnsServerIps, long queryTimeout, long poolSize, long poolRefreshSeconds)
-
-
Method Details
-
initialize
protected void initialize() -
takeLease
-
returnLease
-
stop
public void stop() -
isStopped
protected boolean isStopped() -
randomResolverIndex
protected int randomResolverIndex()Allows for a random resolver to be returned for each request. -
poolSize
protected int poolSize()
-