public interface DnsServiceDiscovererBuilder
ServiceDiscoverer which will attempt to
resolve A, AAAA, CNAME, and SRV type queries.| 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()
|
default DnsServiceDiscovererBuilder |
consolidateCacheSize(int consolidateCacheSize)
Set the maximum size of the cache that is used to consolidate concurrent lookups for different hostnames.
|
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. |
default 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.
|
default 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.
|
default 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.
|
default DnsServiceDiscovererBuilder consolidateCacheSize(int consolidateCacheSize)
This 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 - The maximum number of different hostnames for consolidation of concurrent lookups, or
0 if no consolidation should be performed.this.DnsServiceDiscovererBuilder ttl(int minSeconds, int maxSeconds)
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.
minSeconds - 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.ttl(int, int, int, int),
ttl(int, int, int, int, int)DnsServiceDiscovererBuilder ttl(int minSeconds, int maxSeconds, int minCacheSeconds, int maxCacheSeconds)
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.
minSeconds - 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.ttl(int, int),
ttl(int, int, int, int, int)default DnsServiceDiscovererBuilder ttl(int minSeconds, int maxSeconds, int minCacheSeconds, int maxCacheSeconds, int negativeCacheSeconds)
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.
minSeconds - 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.ttl(int, int),
ttl(int, int, int, int)DnsServiceDiscovererBuilder ttlJitter(Duration ttlJitter)
The jitter value will be added on top of the TTL value returned from the DNS server to avoid hitting the cache.
ttlJitter - The jitter to apply to schedule the next query after TTL.this.default DnsServiceDiscovererBuilder localAddress(@Nullable SocketAddress localAddress)
SocketAddress to bind to.localAddress - 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.DnsServiceDiscovererBuilder dnsServerAddressStreamProvider(@Nullable DnsServerAddressStreamProvider dnsServerAddressStreamProvider)
DnsServerAddressStreamProvider which determines which DNS server should be used per query.dnsServerAddressStreamProvider - the DnsServerAddressStreamProvider which determines which DNS
server should be used per query.this.DnsServiceDiscovererBuilder optResourceEnabled(boolean optResourceEnabled)
optResourceEnabled - if optional records inclusion is enabled.this.DnsServiceDiscovererBuilder maxUdpPayloadSize(int maxUdpPayloadSize)
If the DNS response exceeds this amount the request will be automatically retried via TCP.
maxUdpPayloadSize - the maximum size of the receiving UDP datagram (in bytes)this.DnsServiceDiscovererBuilder ndots(int ndots)
If not set, the default value is read from ndots option of /etc/resolv.conf).
ndots - the ndots value.this.DnsServiceDiscovererBuilder queryTimeout(@Nullable Duration queryTimeout)
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 - the query timeout valuethisresolutionTimeout(Duration)default DnsServiceDiscovererBuilder resolutionTimeout(@Nullable Duration resolutionTimeout)
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 - the query timeout valuethisqueryTimeout(Duration)DnsServiceDiscovererBuilder dnsResolverAddressTypes(@Nullable DnsResolverAddressTypes dnsResolverAddressTypes)
dnsResolverAddressTypes - the address types or null to use the default value, based on "java.net"
system properties: java.net.preferIPv4Stack and java.net.preferIPv6Stack.this.DnsServiceDiscovererBuilder ioExecutor(IoExecutor ioExecutor)
IoExecutor.ioExecutor - IoExecutor to use.this.DnsServiceDiscovererBuilder observer(DnsServiceDiscovererObserver observer)
DnsServiceDiscovererObserver that provides visibility into
DNS ServiceDiscoverer built by this builder.observer - a DnsServiceDiscovererObserver that provides visibility into
DNS ServiceDiscoverer built by this builderthis.DnsServiceDiscovererBuilder missingRecordStatus(ServiceDiscovererEvent.Status status)
ServiceDiscovererEvent.Status to use in ServiceDiscovererEvent.status() when a record
for a previously seen address is missing in the response.status - a ServiceDiscovererEvent.Status for missing records.this.ServiceDiscoverer<String,InetSocketAddress,ServiceDiscovererEvent<InetSocketAddress>> buildSrvDiscoverer()
ServiceDiscoverer which queries
SRV Resource Records corresponding to serviceName. For
each SRV answer capture the Port and resolve the Target.ServiceDiscoverer which queries
SRV Resource Records corresponding to serviceName. For
each SRV answer capture the Port and resolve the Target.ServiceDiscoverer<HostAndPort,InetSocketAddress,ServiceDiscovererEvent<InetSocketAddress>> buildARecordDiscoverer()
ServiceDiscoverer which targets
host addresses (e.g. A or AAAA records) and uses
a fixed port derived from the HostAndPort.ServiceDiscoverer which targets
host addresses (e.g. A or AAAA records) and uses
a fixed port derived from the HostAndPort.