Class DefaultDnsServiceDiscovererBuilder
- All Implemented Interfaces:
DnsServiceDiscovererBuilder
ServiceDiscoverer
which will attempt to
resolve A
, AAAA
, CNAME
, and SRV
type queries.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Build a newServiceDiscoverer
which targets host addresses (e.g.Deprecated.consolidateCacheSize
(int consolidateCacheSize) Deprecated.Set the maximum size of the cache that is used to consolidate concurrent lookups for different hostnames.dnsResolverAddressTypes
(DnsResolverAddressTypes dnsResolverAddressTypes) Deprecated.Sets the list of the protocol families of the address resolved.dnsServerAddressStreamProvider
(DnsServerAddressStreamProvider dnsServerAddressStreamProvider) Deprecated.Set theDnsServerAddressStreamProvider
which determines which DNS server should be used per query.ioExecutor
(IoExecutor ioExecutor) Deprecated.Sets theIoExecutor
.localAddress
(SocketAddress localAddress) Deprecated.Set the localSocketAddress
to bind to.maxUdpPayloadSize
(int maxUdpPayloadSize) Deprecated.Set the maximum size of the receiving UDP datagram (in bytes).minTTL
(int minTTLSeconds) Deprecated.Usettl(int, int)
.Deprecated.Sets whichServiceDiscovererEvent.Status
to use inServiceDiscovererEvent.status()
when a record for a previously seen address is missing in the response.ndots
(int ndots) Deprecated.Set the number of dots which must appear in a name before an initial absolute query is made.observer
(DnsServiceDiscovererObserver observer) Deprecated.Sets aDnsServiceDiscovererObserver
that provides visibility into DNSServiceDiscoverer
built by this builder.optResourceEnabled
(boolean optResourceEnabled) Deprecated.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.queryTimeout
(Duration queryTimeout) Deprecated.Sets the timeout of each DNS query performed by this service discoverer.ttl
(int minSeconds, int maxSeconds) Deprecated.Controls min/max TTL values that will influence polling intervals.ttl
(int minSeconds, int maxSeconds, int minCacheSeconds, int maxCacheSeconds) Deprecated.Controls min/max TTL values that will affect polling intervals and local caching.ttl
(int minSeconds, int maxSeconds, int minCacheSeconds, int maxCacheSeconds, int negativeTTLCacheSeconds) Deprecated.Controls min/max TTL values that will affect polling intervals, local caching, and caching negative results.Deprecated.The jitter to apply for scheduling the next query after TTL to help spread out subsequent DNS queries.
-
Constructor Details
-
DefaultDnsServiceDiscovererBuilder
Deprecated.useDnsServiceDiscoverers.builder(String)
instead.Creates a newDefaultDnsServiceDiscovererBuilder
.
-
-
Method Details
-
consolidateCacheSize
Deprecated.Description copied from interface:DnsServiceDiscovererBuilder
Set the maximum size of the cache that is used to consolidate concurrent lookups for different hostnames.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.
- Specified by:
consolidateCacheSize
in interfaceDnsServiceDiscovererBuilder
- Parameters:
consolidateCacheSize
- The maximum number of different hostnames for consolidation of concurrent lookups, or0
if no consolidation should be performed.- Returns:
this
.
-
minTTL
Deprecated.Usettl(int, int)
.The minimum allowed TTL. This will be the minimum poll interval.- Parameters:
minTTLSeconds
- The minimum amount of time a cache entry will be considered valid (in seconds).- Returns:
this
.
-
ttl
Deprecated.Description copied from interface:DnsServiceDiscovererBuilder
Controls min/max TTL values that will influence polling intervals.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.
- Specified by:
ttl
in interfaceDnsServiceDiscovererBuilder
- Parameters:
minSeconds
- The minimum about of time the result will be considered valid (in seconds), must be greater than0
.maxSeconds
- The maximum about of time the result will be considered valid (in seconds), must be greater than or equal tominSeconds
.- Returns:
this
.- See Also:
-
ttl
public DefaultDnsServiceDiscovererBuilder ttl(int minSeconds, int maxSeconds, int minCacheSeconds, int maxCacheSeconds) Deprecated.Description copied from interface:DnsServiceDiscovererBuilder
Controls min/max TTL values that will affect polling intervals and local caching.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.
- Specified by:
ttl
in interfaceDnsServiceDiscovererBuilder
- Parameters:
minSeconds
- The minimum about of time the result will be considered valid (in seconds), must be greater than0
.maxSeconds
- The maximum about of time the result will be considered valid (in seconds), must be greater than or equal tominSeconds
.minCacheSeconds
- The minimum about of time the result will be cached locally (in seconds), must be greater than or equal to0
, and less than or equal tominSeconds
.maxCacheSeconds
- The maximum about of time the result will be cached locally (in seconds), must be greater than or equal tominCacheSeconds
, and less than or equal tomaxSeconds
.- Returns:
this
.- See Also:
-
ttl
public DefaultDnsServiceDiscovererBuilder ttl(int minSeconds, int maxSeconds, int minCacheSeconds, int maxCacheSeconds, int negativeTTLCacheSeconds) Deprecated.Description copied from interface:DnsServiceDiscovererBuilder
Controls min/max TTL values that will affect polling intervals, local caching, and caching negative results.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.
- Specified by:
ttl
in interfaceDnsServiceDiscovererBuilder
- Parameters:
minSeconds
- The minimum about of time the result will be considered valid (in seconds), must be greater than0
.maxSeconds
- The maximum about of time the result will be considered valid (in seconds), must be greater than or equal tominSeconds
.minCacheSeconds
- The minimum about of time the result will be cached locally (in seconds), must be greater than or equal to0
, and less than or equal tominSeconds
.maxCacheSeconds
- The maximum about of time the result will be cached locally (in seconds), must be greater than or equal tominCacheSeconds
, and less than or equal tomaxSeconds
.negativeTTLCacheSeconds
- The amount of time an unsuccessful (failed) result will be cached locally (in seconds), must be greater than or equal to0
. If other overloads are used, the default value will recognize the standard Java system propertynetworkaddress.cache.negative.ttl
, likeInetAddress
does.- Returns:
this
.- See Also:
-
ttlJitter
Deprecated.Description copied from interface:DnsServiceDiscovererBuilder
The jitter to apply for scheduling the next query after TTL to help spread out subsequent DNS queries.The jitter value will be added on top of the TTL value returned from the DNS server to avoid hitting the cache.
- Specified by:
ttlJitter
in interfaceDnsServiceDiscovererBuilder
- Parameters:
ttlJitter
- The jitter to apply to schedule the next query after TTL.- Returns:
this
.
-
localAddress
Deprecated.Description copied from interface:DnsServiceDiscovererBuilder
Set the localSocketAddress
to bind to.- Specified by:
localAddress
in interfaceDnsServiceDiscovererBuilder
- Parameters:
localAddress
- the localSocketAddress
to bind to ornull
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.- Returns:
this
.
-
dnsServerAddressStreamProvider
public DefaultDnsServiceDiscovererBuilder dnsServerAddressStreamProvider(@Nullable DnsServerAddressStreamProvider dnsServerAddressStreamProvider) Deprecated.Description copied from interface:DnsServiceDiscovererBuilder
Set theDnsServerAddressStreamProvider
which determines which DNS server should be used per query.- Specified by:
dnsServerAddressStreamProvider
in interfaceDnsServiceDiscovererBuilder
- Parameters:
dnsServerAddressStreamProvider
- theDnsServerAddressStreamProvider
which determines which DNS server should be used per query.- Returns:
this
.
-
optResourceEnabled
Deprecated.Description copied from interface:DnsServiceDiscovererBuilder
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. Some DNSServer may not support this and so fail to answer queries. If you find problems you may want to disable this.- Specified by:
optResourceEnabled
in interfaceDnsServiceDiscovererBuilder
- Parameters:
optResourceEnabled
- if optional records inclusion is enabled.- Returns:
this
.
-
maxUdpPayloadSize
Deprecated.Description copied from interface:DnsServiceDiscovererBuilder
Set the maximum size of the receiving UDP datagram (in bytes).If the DNS response exceeds this amount the request will be automatically retried via TCP.
- Specified by:
maxUdpPayloadSize
in interfaceDnsServiceDiscovererBuilder
- Parameters:
maxUdpPayloadSize
- the maximum size of the receiving UDP datagram (in bytes)- Returns:
this
.
-
ndots
Deprecated.Description copied from interface:DnsServiceDiscovererBuilder
Set the number of dots which must appear in a name before an initial absolute query is made.- Specified by:
ndots
in interfaceDnsServiceDiscovererBuilder
- Parameters:
ndots
- the ndots value.- Returns:
this
.
-
queryTimeout
Deprecated.Description copied from interface:DnsServiceDiscovererBuilder
Sets the timeout of each DNS query performed by this service discoverer.- Specified by:
queryTimeout
in interfaceDnsServiceDiscovererBuilder
- Parameters:
queryTimeout
- the query timeout value- Returns:
this
.
-
dnsResolverAddressTypes
public DefaultDnsServiceDiscovererBuilder dnsResolverAddressTypes(@Nullable DnsResolverAddressTypes dnsResolverAddressTypes) Deprecated.Description copied from interface:DnsServiceDiscovererBuilder
Sets the list of the protocol families of the address resolved.- Specified by:
dnsResolverAddressTypes
in interfaceDnsServiceDiscovererBuilder
- Parameters:
dnsResolverAddressTypes
- the address types ornull
to use the default value, based on "java.net" system properties:java.net.preferIPv4Stack
andjava.net.preferIPv6Stack
.- Returns:
this
.
-
ioExecutor
Deprecated.Description copied from interface:DnsServiceDiscovererBuilder
Sets theIoExecutor
.- Specified by:
ioExecutor
in interfaceDnsServiceDiscovererBuilder
- Parameters:
ioExecutor
-IoExecutor
to use.- Returns:
this
.
-
observer
Deprecated.Description copied from interface:DnsServiceDiscovererBuilder
Sets aDnsServiceDiscovererObserver
that provides visibility into DNSServiceDiscoverer
built by this builder.- Specified by:
observer
in interfaceDnsServiceDiscovererBuilder
- Parameters:
observer
- aDnsServiceDiscovererObserver
that provides visibility into DNSServiceDiscoverer
built by this builder- Returns:
this
.
-
missingRecordStatus
Deprecated.Description copied from interface:DnsServiceDiscovererBuilder
Sets whichServiceDiscovererEvent.Status
to use inServiceDiscovererEvent.status()
when a record for a previously seen address is missing in the response.- Specified by:
missingRecordStatus
in interfaceDnsServiceDiscovererBuilder
- Parameters:
status
- aServiceDiscovererEvent.Status
for missing records.- Returns:
this
.
-
buildSrvDiscoverer
public ServiceDiscoverer<String,InetSocketAddress, buildSrvDiscoverer()ServiceDiscovererEvent<InetSocketAddress>> Deprecated.Description copied from interface:DnsServiceDiscovererBuilder
Build a newServiceDiscoverer
which queries SRV Resource Records corresponding toserviceName
. For each SRV answer capture the Port and resolve the Target.- Specified by:
buildSrvDiscoverer
in interfaceDnsServiceDiscovererBuilder
- Returns:
- a new
ServiceDiscoverer
which queries SRV Resource Records corresponding toserviceName
. For each SRV answer capture the Port and resolve the Target.
-
buildARecordDiscoverer
public ServiceDiscoverer<HostAndPort,InetSocketAddress, buildARecordDiscoverer()ServiceDiscovererEvent<InetSocketAddress>> Deprecated.Description copied from interface:DnsServiceDiscovererBuilder
Build a newServiceDiscoverer
which targets host addresses (e.g. A or AAAA records) and uses a fixed port derived from theHostAndPort
.- Specified by:
buildARecordDiscoverer
in interfaceDnsServiceDiscovererBuilder
- Returns:
- a new
ServiceDiscoverer
which targets host addresses (e.g. A or AAAA records) and uses a fixed port derived from theHostAndPort
.
-
DnsServiceDiscovererBuilder
instead.