Modifier and Type | Field and Description |
---|---|
static Duration |
DEFAULT_RESOLVER_TIMEOUT
Default timeout until resolving with one of the used resolvers fails.
|
static Duration |
DEFAULT_TIMEOUT
Default timeout until resolving is aborted.
|
Constructor and Description |
---|
ExtendedResolver()
Creates a new Extended Resolver.
|
ExtendedResolver(Iterable<Resolver> resolvers)
Creates a new
ExtendedResolver . |
ExtendedResolver(Resolver[] resolvers)
Creates a new Extended Resolver
|
ExtendedResolver(String[] servers)
Creates a new instance with
SimpleResolver s. |
Modifier and Type | Method and Description |
---|---|
void |
addResolver(Resolver r)
Adds a new resolver to be used by this ExtendedResolver
|
void |
deleteResolver(Resolver r)
Deletes a resolver used by this ExtendedResolver
|
boolean |
getLoadBalance()
Gets whether the servers receive queries load balanced.
|
Resolver |
getResolver(int n)
Returns the nth resolver used by this ExtendedResolver
|
Resolver[] |
getResolvers()
Returns all resolvers used by this ExtendedResolver
|
int |
getRetries()
Gets the number of retries sent to each server per query.
|
Duration |
getTimeout()
Gets the amount of time to wait for a response before giving up.
|
CompletionStage<Message> |
sendAsync(Message query)
Sends a message to multiple servers, and queries are sent multiple times until either a
successful response is received, or it is clear that there is no successful response.
|
CompletionStage<Message> |
sendAsync(Message query,
Executor executor)
Sends a message to multiple servers, and queries are sent multiple times until either a
successful response is received, or it is clear that there is no successful response.
|
void |
setEDNS(int version,
int payloadSize,
int flags,
List<EDNSOption> options)
Sets the EDNS information on outgoing messages.
|
void |
setIgnoreTruncation(boolean flag)
Sets whether truncated responses will be ignored.
|
void |
setLoadBalance(boolean flag)
Sets whether the servers should be load balanced.
|
void |
setPort(int port)
Sets the port to communicate with on the server
|
void |
setRetries(int retries)
Sets the number of retries sent to each server per query
|
void |
setTCP(boolean flag)
Sets whether TCP connections will be used by default
|
void |
setTimeout(Duration timeout)
Sets the timeout for the
ExtendedResolver . |
void |
setTSIGKey(TSIG key)
Specifies the TSIG key that messages will be signed with
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
send, sendAsync, setEDNS, setEDNS, setTimeout, setTimeout
public static final Duration DEFAULT_TIMEOUT
public static final Duration DEFAULT_RESOLVER_TIMEOUT
public ExtendedResolver()
ResolverConfig
is used to determine the
servers for which SimpleResolver
s are initialized. The timeout for each server is
initialized with DEFAULT_RESOLVER_TIMEOUT
.public ExtendedResolver(String[] servers) throws UnknownHostException
SimpleResolver
s. The timeout for each server is initialized
with DEFAULT_RESOLVER_TIMEOUT
.servers
- An array of server names or IP addresses for which SimpleResolver
s are
initialized.UnknownHostException
- A server name could not be resolvedpublic ExtendedResolver(Resolver[] resolvers)
resolvers
- An array of pre-initialized Resolver
s.public ExtendedResolver(Iterable<Resolver> resolvers)
ExtendedResolver
. No timeout value is applied to the individual
resolvers, make sure their timeout is smaller than the timeout of this ExtendedResolver
.resolvers
- An iterable of pre-initialized Resolver
s.public void setPort(int port)
Resolver
public void setTCP(boolean flag)
Resolver
public void setIgnoreTruncation(boolean flag)
Resolver
setIgnoreTruncation
in interface Resolver
flag
- Indicates whether truncated responses should be ignored.public void setEDNS(int version, int payloadSize, int flags, List<EDNSOption> options)
Resolver
setEDNS
in interface Resolver
version
- The EDNS version to use. 0 indicates EDNS0 and -1 indicates no EDNS.payloadSize
- The maximum DNS packet size that this host is capable of receiving over UDP.
If 0 is specified, the default (1280) is used.flags
- EDNS extended flags to be set in the OPT record.options
- EDNS options to be set in the OPT record, specified as a List of
OPTRecord.Option elements.OPTRecord
public void setTSIGKey(TSIG key)
Resolver
setTSIGKey
in interface Resolver
key
- The keypublic Duration getTimeout()
Resolver
getTimeout
in interface Resolver
Resolver.setTimeout(Duration)
public void setTimeout(Duration timeout)
ExtendedResolver
.
Note that this only sets the timeout for the ExtendedResolver
, not the
individual Resolver
s. If the timeout expires, the ExtendedResolver
simply stops
retrying, it does not abort running queries. The timeout value must be larger than that for the
individual resolver to have any effect.
setTimeout
in interface Resolver
timeout
- The amount of time to wait before sending further queries.ExtendedResolver()
,
ExtendedResolver(String[])
public CompletionStage<Message> sendAsync(Message query)
public CompletionStage<Message> sendAsync(Message query, Executor executor)
public Resolver getResolver(int n)
public Resolver[] getResolvers()
public void addResolver(Resolver r)
public void deleteResolver(Resolver r)
public boolean getLoadBalance()
public void setLoadBalance(boolean flag)
flag
- If true, servers will be tried in round-robin order. If false, servers will always
be queried in the same order.public int getRetries()
public void setRetries(int retries)
Copyright © 2022 dnsjava.org. All rights reserved.