Class DnsResolverPool

java.lang.Object
org.graylog2.lookup.adapters.dnslookup.DnsResolverPool

public class DnsResolverPool extends Object
Manages a pool of Netty 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.
  • Constructor Details

    • DnsResolverPool

      protected DnsResolverPool(String dnsServerIps, long queryTimeout, long poolSize, long poolRefreshSeconds)
  • Method Details

    • initialize

      protected void initialize()
    • takeLease

      protected DnsResolverPool.ResolverLease takeLease()
    • returnLease

      protected void returnLease(DnsResolverPool.ResolverLease lease)
    • 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()