Package org.xbill.DNS
Class ExtendedResolver
java.lang.Object
org.xbill.DNS.ExtendedResolver
- All Implemented Interfaces:
Resolver
An implementation of
Resolver that can send queries to multiple servers, sending the
queries multiple times if necessary.- Author:
- Brian Wellington
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new Extended Resolver.ExtendedResolver(Iterable<Resolver> resolvers) Creates a newExtendedResolver.ExtendedResolver(String[] servers) Creates a new instance withSimpleResolvers.ExtendedResolver(Resolver[] resolvers) Creates a new Extended Resolver -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new resolver to be used by this ExtendedResolvervoidDeletes a resolver used by this ExtendedResolverbooleanGets whether the servers receive queries load balanced.getResolver(int n) Returns the nth resolver used by this ExtendedResolverResolver[]Returns all resolvers used by this ExtendedResolverintGets the number of retries sent to each server per query.Gets the amount of time to wait for a response before giving up.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.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.voidsetEDNS(int version, int payloadSize, int flags, List<EDNSOption> options) Sets the EDNS information on outgoing messages.voidsetIgnoreTruncation(boolean flag) Sets whether truncated responses will be ignored.voidsetLoadBalance(boolean flag) Sets whether the servers should be load balanced.voidsetPort(int port) Sets the port to communicate with on the servervoidsetRetries(int retries) Sets the number of retries sent to each server per queryvoidsetTCP(boolean flag) Sets whether TCP connections will be used by defaultvoidsetTimeout(Duration timeout) Sets the timeout for theExtendedResolver.voidsetTSIGKey(TSIG key) Specifies the TSIG key that messages will be signed withtoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.xbill.DNS.Resolver
send, sendAsync, setEDNS, setEDNS, setTimeout, setTimeout
-
Field Details
-
DEFAULT_TIMEOUT
Default timeout until resolving is aborted.- Since:
- 3.2
-
DEFAULT_RESOLVER_TIMEOUT
Default timeout until resolving with one of the used resolvers fails.- Since:
- 3.2
-
-
Constructor Details
-
ExtendedResolver
public ExtendedResolver()Creates a new Extended Resolver. The defaultResolverConfigis used to determine the servers for whichSimpleResolvers are initialized. The timeout for each server is initialized withDEFAULT_RESOLVER_TIMEOUT. -
ExtendedResolver
Creates a new instance withSimpleResolvers. The timeout for each server is initialized withDEFAULT_RESOLVER_TIMEOUT.- Parameters:
servers- An array of server names or IP addresses for whichSimpleResolvers are initialized.- Throws:
UnknownHostException- A server name could not be resolved
-
ExtendedResolver
Creates a new Extended Resolver- Parameters:
resolvers- An array of pre-initializedResolvers.
-
ExtendedResolver
Creates a newExtendedResolver. No timeout value is applied to the individual resolvers, make sure their timeout is smaller than the timeout of thisExtendedResolver.- Parameters:
resolvers- An iterable of pre-initializedResolvers.
-
-
Method Details
-
setPort
public void setPort(int port) Description copied from interface:ResolverSets the port to communicate with on the server -
setTCP
public void setTCP(boolean flag) Description copied from interface:ResolverSets whether TCP connections will be used by default -
setIgnoreTruncation
public void setIgnoreTruncation(boolean flag) Description copied from interface:ResolverSets whether truncated responses will be ignored. If not, a truncated response over UDP will cause a retransmission over TCP.- Specified by:
setIgnoreTruncationin interfaceResolver- Parameters:
flag- Indicates whether truncated responses should be ignored.
-
setEDNS
Description copied from interface:ResolverSets the EDNS information on outgoing messages.- Specified by:
setEDNSin interfaceResolver- Parameters:
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.- See Also:
-
setTSIGKey
Description copied from interface:ResolverSpecifies the TSIG key that messages will be signed with- Specified by:
setTSIGKeyin interfaceResolver- Parameters:
key- The key
-
getTimeout
Description copied from interface:ResolverGets the amount of time to wait for a response before giving up.- Specified by:
getTimeoutin interfaceResolver- See Also:
-
setTimeout
Sets the timeout for theExtendedResolver.Note that this only sets the timeout for the
ExtendedResolver, not the individualResolvers. If the timeout expires, theExtendedResolversimply stops retrying, it does not abort running queries. The timeout value must be larger than that for the individual resolver to have any effect.- Specified by:
setTimeoutin interfaceResolver- Parameters:
timeout- The amount of time to wait before sending further queries.- See Also:
-
sendAsync
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. -
sendAsync
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. -
getResolver
Returns the nth resolver used by this ExtendedResolver -
getResolvers
Returns all resolvers used by this ExtendedResolver -
addResolver
Adds a new resolver to be used by this ExtendedResolver -
deleteResolver
Deletes a resolver used by this ExtendedResolver -
getLoadBalance
public boolean getLoadBalance()Gets whether the servers receive queries load balanced.- Since:
- 3.2
-
setLoadBalance
public void setLoadBalance(boolean flag) Sets whether the servers should be load balanced.- Parameters:
flag- If true, servers will be tried in round-robin order. If false, servers will always be queried in the same order.
-
getRetries
public int getRetries()Gets the number of retries sent to each server per query.- Since:
- 3.2
-
setRetries
public void setRetries(int retries) Sets the number of retries sent to each server per query -
toString
-