public class DelegatingDnsServiceDiscovererBuilder extends Object implements DnsServiceDiscovererBuilder
DnsServiceDiscovererBuilder that delegates all methods to another DnsServiceDiscovererBuilder.| Constructor and Description |
|---|
DelegatingDnsServiceDiscovererBuilder(DnsServiceDiscovererBuilder delegate)
Creates a new builder which delegates to the provided
DnsServiceDiscovererBuilder. |
| Modifier and Type | Method and Description |
|---|---|
ServiceDiscoverer<HostAndPort,InetSocketAddress,ServiceDiscovererEvent<InetSocketAddress>> |
buildARecordDiscoverer()
Build a new
ServiceDiscoverer which targets
host addresses (e.g. |
ServiceDiscoverer<String,InetSocketAddress,ServiceDiscovererEvent<InetSocketAddress>> |
buildSrvDiscoverer()
|
DnsServiceDiscovererBuilder |
consolidateCacheSize(int consolidateCacheSize)
Set the maximum size of the cache that is used to consolidate concurrent lookups for different hostnames.
|
protected DnsServiceDiscovererBuilder |
delegate()
Returns the
DnsServiceDiscovererBuilder delegate. |
DnsServiceDiscovererBuilder |
dnsResolverAddressTypes(DnsResolverAddressTypes dnsResolverAddressTypes)
Sets the list of the protocol families of the address resolved.
|
DnsServiceDiscovererBuilder |
dnsServerAddressStreamProvider(DnsServerAddressStreamProvider dnsServerAddressStreamProvider)
Set the
DnsServerAddressStreamProvider which determines which DNS server should be used per query. |
DnsServiceDiscovererBuilder |
ioExecutor(IoExecutor ioExecutor)
Sets the
IoExecutor. |
DnsServiceDiscovererBuilder |
localAddress(SocketAddress localAddress)
Set the local
SocketAddress to bind to. |
DnsServiceDiscovererBuilder |
maxUdpPayloadSize(int maxUdpPayloadSize)
Set the maximum size of the receiving UDP datagram (in bytes).
|
DnsServiceDiscovererBuilder |
missingRecordStatus(ServiceDiscovererEvent.Status status)
Sets which
ServiceDiscovererEvent.Status to use in ServiceDiscovererEvent.status() when a record
for a previously seen address is missing in the response. |
DnsServiceDiscovererBuilder |
ndots(int ndots)
Set the number of dots which must appear in a name before an initial absolute query is made.
|
DnsServiceDiscovererBuilder |
observer(DnsServiceDiscovererObserver observer)
Sets a
DnsServiceDiscovererObserver that provides visibility into
DNS ServiceDiscoverer built by this builder. |
DnsServiceDiscovererBuilder |
optResourceEnabled(boolean optResourceEnabled)
Enable the automatic inclusion of a optional records that tries to give the remote DNS server a hint about
how much data the resolver can read per response.
|
DnsServiceDiscovererBuilder |
queryTimeout(Duration queryTimeout)
Sets the timeout of each DNS query performed by this service discoverer as part of a resolution request.
|
DnsServiceDiscovererBuilder |
resolutionTimeout(Duration resolutionTimeout)
Sets the total timeout of each DNS resolution performed by this service discoverer.
|
DnsServiceDiscovererBuilder |
ttl(int minSeconds,
int maxSeconds)
Controls min/max TTL values that will influence polling intervals.
|
DnsServiceDiscovererBuilder |
ttl(int minSeconds,
int maxSeconds,
int minCacheSeconds,
int maxCacheSeconds)
Controls min/max TTL values that will affect polling intervals and local caching.
|
DnsServiceDiscovererBuilder |
ttl(int minSeconds,
int maxSeconds,
int minCacheSeconds,
int maxCacheSeconds,
int negativeCacheSeconds)
Controls min/max TTL values that will affect polling intervals, local caching, and caching negative results.
|
DnsServiceDiscovererBuilder |
ttlJitter(Duration ttlJitter)
The jitter to apply for scheduling the next query after TTL to help spread out subsequent DNS queries.
|
public DelegatingDnsServiceDiscovererBuilder(DnsServiceDiscovererBuilder delegate)
DnsServiceDiscovererBuilder.delegate - the delegate builder.protected final DnsServiceDiscovererBuilder delegate()
DnsServiceDiscovererBuilder delegate.DnsServiceDiscovererBuilder.public DnsServiceDiscovererBuilder consolidateCacheSize(int consolidateCacheSize)
DnsServiceDiscovererBuilderThis means if multiple lookups are done for the same hostname and still in-flight, only one actual query will be made and the result will be cascaded to the others.
consolidateCacheSize in interface DnsServiceDiscovererBuilderconsolidateCacheSize - The maximum number of different hostnames for consolidation of concurrent lookups, or
0 if no consolidation should be performed.this.public DnsServiceDiscovererBuilder ttl(int minSeconds, int maxSeconds)
DnsServiceDiscovererBuilder
The created ServiceDiscoverer polls DNS server based on TTL value of the resolved records. Min/max values
help to make sure polling stays within reasonable boundaries. Too frequent DNS queries may generate too much load
for the DNS server, too rare DNS queries may lead to incorrect state if the remote servers changed IPs before
original TTL expired.
With this overload, there will be no local caching for resolved records.
ttl in interface DnsServiceDiscovererBuilderminSeconds - The minimum about of time the result will be considered valid (in seconds), must be greater
than 0.maxSeconds - The maximum about of time the result will be considered valid (in seconds), must be greater
than or equal to minSeconds.this.DnsServiceDiscovererBuilder.ttl(int, int, int, int),
DnsServiceDiscovererBuilder.ttl(int, int, int, int, int)public DnsServiceDiscovererBuilder ttl(int minSeconds, int maxSeconds, int minCacheSeconds, int maxCacheSeconds)
DnsServiceDiscovererBuilder
The created ServiceDiscoverer polls DNS server based on TTL value of the resolved records. Min/max values
help to make sure polling stays within reasonable boundaries. Too frequent DNS queries may generate too much load
for the DNS server, too rare DNS queries may lead to incorrect state if the remote servers changed IPs before
original TTL expired.
The second min/max pair controls for how long the resolved records should be cached locally. Cache is helpful in scenarios when multiple concurrent resolutions are possible for the same address: either an application runs multiple client instances for the same hostname or clients perform DNS resolutions per new connection instead of background polling.
ttl in interface DnsServiceDiscovererBuilderminSeconds - The minimum about of time the result will be considered valid (in seconds), must be greater
than 0.maxSeconds - The maximum about of time the result will be considered valid (in seconds), must be greater
than or equal to minSeconds.minCacheSeconds - The minimum about of time the result will be cached locally (in seconds), must be greater
than or equal to 0, and less than or equal to minSeconds.maxCacheSeconds - The maximum about of time the result will be cached locally (in seconds), must be greater
than or equal to minCacheSeconds, and less than or equal to maxSeconds.this.DnsServiceDiscovererBuilder.ttl(int, int),
DnsServiceDiscovererBuilder.ttl(int, int, int, int, int)public DnsServiceDiscovererBuilder ttl(int minSeconds, int maxSeconds, int minCacheSeconds, int maxCacheSeconds, int negativeCacheSeconds)
DnsServiceDiscovererBuilder
The created ServiceDiscoverer polls DNS server based on TTL value of the resolved records. Min/max values
help to make sure polling stays within reasonable boundaries. Too frequent DNS queries may generate too much load
for the DNS server, too rare DNS queries may lead to incorrect state if the remote servers changed IPs before
original TTL expired.
The second min/max pair controls for how long the resolved records should be cached locally. Cache is helpful in scenarios when multiple concurrent resolutions are possible for the same address: either an application runs multiple client instances for the same hostname or clients perform DNS resolutions per new connection instead of background polling.
ttl in interface DnsServiceDiscovererBuilderminSeconds - The minimum about of time the result will be considered valid (in seconds), must be greater
than 0.maxSeconds - The maximum about of time the result will be considered valid (in seconds), must be greater
than or equal to minSeconds.minCacheSeconds - The minimum about of time the result will be cached locally (in seconds), must be greater
than or equal to 0, and less than or equal to minSeconds.maxCacheSeconds - The maximum about of time the result will be cached locally (in seconds), must be greater
than or equal to minCacheSeconds, and less than or equal to maxSeconds.negativeCacheSeconds - The amount of time an unsuccessful (failed) result will be cached locally (in
seconds), must be greater than or equal to 0. If other overloads are used, the default value will
recognize the standard Java system property networkaddress.cache.negative.ttl,
like InetAddress does.this.DnsServiceDiscovererBuilder.ttl(int, int),
DnsServiceDiscovererBuilder.ttl(int, int, int, int)public DnsServiceDiscovererBuilder ttlJitter(Duration ttlJitter)
DnsServiceDiscovererBuilderThe jitter value will be added on top of the TTL value returned from the DNS server to avoid hitting the cache.
ttlJitter in interface DnsServiceDiscovererBuilderttlJitter - The jitter to apply to schedule the next query after TTL.this.public DnsServiceDiscovererBuilder localAddress(@Nullable SocketAddress localAddress)
DnsServiceDiscovererBuilderSocketAddress to bind to.localAddress in interface DnsServiceDiscovererBuilderlocalAddress - the local SocketAddress to bind to or null to skip binding. When specified,
all DNS queries will be sent from the specified address. When skipped, OS will automatically bind before sending
frames but address won't be available in logs.this.public DnsServiceDiscovererBuilder dnsServerAddressStreamProvider(@Nullable DnsServerAddressStreamProvider dnsServerAddressStreamProvider)
DnsServiceDiscovererBuilderDnsServerAddressStreamProvider which determines which DNS server should be used per query.dnsServerAddressStreamProvider in interface DnsServiceDiscovererBuilderdnsServerAddressStreamProvider - the DnsServerAddressStreamProvider which determines which DNS
server should be used per query.this.public DnsServiceDiscovererBuilder optResourceEnabled(boolean optResourceEnabled)
DnsServiceDiscovererBuilderoptResourceEnabled in interface DnsServiceDiscovererBuilderoptResourceEnabled - if optional records inclusion is enabled.this.public DnsServiceDiscovererBuilder maxUdpPayloadSize(int maxUdpPayloadSize)
DnsServiceDiscovererBuilderIf the DNS response exceeds this amount the request will be automatically retried via TCP.
maxUdpPayloadSize in interface DnsServiceDiscovererBuildermaxUdpPayloadSize - the maximum size of the receiving UDP datagram (in bytes)this.public DnsServiceDiscovererBuilder ndots(int ndots)
DnsServiceDiscovererBuilder
If not set, the default value is read from ndots option of /etc/resolv.conf).
ndots in interface DnsServiceDiscovererBuilderndots - the ndots value.this.public DnsServiceDiscovererBuilder queryTimeout(@Nullable Duration queryTimeout)
DnsServiceDiscovererBuilder
Zero (0) disables the timeout. If not set, the default value is read from timeout option of
/etc/resolv.conf). Similar to linux systems, this value may be silently capped.
queryTimeout in interface DnsServiceDiscovererBuilderqueryTimeout - the query timeout valuethisDnsServiceDiscovererBuilder.resolutionTimeout(Duration)public DnsServiceDiscovererBuilder resolutionTimeout(@Nullable Duration resolutionTimeout)
DnsServiceDiscovererBuilder
Each resolution may execute one or more DNS queries, like following multiple CNAME(s) or trying different search
domains. This is the total timeout for all intermediate queries involved in a single resolution request. Note,
that SRV resolutions may generate independent resolutions for
A/AAAA records. In this case, this timeout will be applied to an SRV resolution and each
A/AAAA resolution independently.
Zero (0) disables the timeout. If not set, it defaults to query timeout
value multiplied by 2.
resolutionTimeout in interface DnsServiceDiscovererBuilderresolutionTimeout - the query timeout valuethisDnsServiceDiscovererBuilder.queryTimeout(Duration)public DnsServiceDiscovererBuilder dnsResolverAddressTypes(@Nullable DnsResolverAddressTypes dnsResolverAddressTypes)
DnsServiceDiscovererBuilderdnsResolverAddressTypes in interface DnsServiceDiscovererBuilderdnsResolverAddressTypes - the address types or null to use the default value, based on "java.net"
system properties: java.net.preferIPv4Stack and java.net.preferIPv6Stack.this.public DnsServiceDiscovererBuilder ioExecutor(IoExecutor ioExecutor)
DnsServiceDiscovererBuilderIoExecutor.ioExecutor in interface DnsServiceDiscovererBuilderioExecutor - IoExecutor to use.this.public DnsServiceDiscovererBuilder observer(DnsServiceDiscovererObserver observer)
DnsServiceDiscovererBuilderDnsServiceDiscovererObserver that provides visibility into
DNS ServiceDiscoverer built by this builder.observer in interface DnsServiceDiscovererBuilderobserver - a DnsServiceDiscovererObserver that provides visibility into
DNS ServiceDiscoverer built by this builderthis.public DnsServiceDiscovererBuilder missingRecordStatus(ServiceDiscovererEvent.Status status)
DnsServiceDiscovererBuilderServiceDiscovererEvent.Status to use in ServiceDiscovererEvent.status() when a record
for a previously seen address is missing in the response.missingRecordStatus in interface DnsServiceDiscovererBuilderstatus - a ServiceDiscovererEvent.Status for missing records.this.public ServiceDiscoverer<String,InetSocketAddress,ServiceDiscovererEvent<InetSocketAddress>> buildSrvDiscoverer()
DnsServiceDiscovererBuilderServiceDiscoverer which queries
SRV Resource Records corresponding to serviceName. For
each SRV answer capture the Port and resolve the Target.buildSrvDiscoverer in interface DnsServiceDiscovererBuilderServiceDiscoverer which queries
SRV Resource Records corresponding to serviceName. For
each SRV answer capture the Port and resolve the Target.public ServiceDiscoverer<HostAndPort,InetSocketAddress,ServiceDiscovererEvent<InetSocketAddress>> buildARecordDiscoverer()
DnsServiceDiscovererBuilderServiceDiscoverer which targets
host addresses (e.g. A or AAAA records) and uses
a fixed port derived from the HostAndPort.buildARecordDiscoverer in interface DnsServiceDiscovererBuilderServiceDiscoverer which targets
host addresses (e.g. A or AAAA records) and uses
a fixed port derived from the HostAndPort.