public interface Resolver
Modifier and Type | Method and Description |
---|---|
default Duration |
getTimeout()
Gets the amount of time to wait for a response before giving up.
|
default Message |
send(Message query)
Sends a message and waits for a response.
|
default CompletionStage<Message> |
sendAsync(Message query)
Asynchronously sends a message using the default
ForkJoinPool.commonPool() . |
default CompletionStage<Message> |
sendAsync(Message query,
Executor executor)
Asynchronously sends a message.
|
default Object |
sendAsync(Message query,
ResolverListener listener)
Deprecated.
|
default void |
setEDNS(int version)
Sets the EDNS version used on outgoing messages.
|
default void |
setEDNS(int version,
int payloadSize,
int flags,
EDNSOption... options)
Sets the EDNS information on outgoing messages.
|
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 |
setPort(int port)
Sets the port to communicate with on the server
|
void |
setTCP(boolean flag)
Sets whether TCP connections will be used by default
|
void |
setTimeout(Duration timeout)
Sets the amount of time to wait for a response before giving up.
|
default void |
setTimeout(int secs)
Deprecated.
|
default void |
setTimeout(int secs,
int msecs)
Deprecated.
|
void |
setTSIGKey(TSIG key)
Specifies the TSIG key that messages will be signed with
|
void setPort(int port)
port
- The port to send messages tovoid setTCP(boolean flag)
flag
- Indicates whether TCP connections are madevoid setIgnoreTruncation(boolean flag)
flag
- Indicates whether truncated responses should be ignored.default void setEDNS(int version)
version
- The EDNS level to use. 0 indicates EDNS0 and -1 indicates no EDNS.IllegalArgumentException
- An invalid level was indicated.void setEDNS(int version, int payloadSize, int flags, List<EDNSOption> options)
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.IllegalArgumentException
- An invalid field was specified.OPTRecord
default void setEDNS(int version, int payloadSize, int flags, EDNSOption... options)
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.IllegalArgumentException
- An invalid field was specified.OPTRecord
void setTSIGKey(TSIG key)
key
- The key@Deprecated default void setTimeout(int secs, int msecs)
setTimeout(Duration)
secs
- The number of seconds to wait.msecs
- The number of milliseconds to wait.@Deprecated default void setTimeout(int secs)
setTimeout(Duration)
secs
- The number of seconds to wait.void setTimeout(Duration timeout)
timeout
- The amount of time to wait.default Duration getTimeout()
setTimeout(Duration)
default Message send(Message query) throws IOException
The waiting is done on the calling thread. Do not call this method from async code, and
especially not from tasks running on ForkJoinPool.commonPool()
, use sendAsync(Message)
or sendAsync(Message, Executor)
instead.
query
- The query to send.IOException
- An error occurred while sending or receiving.default CompletionStage<Message> sendAsync(Message query)
ForkJoinPool.commonPool()
.
The default implementation calls the deprecated sendAsync(Message,
ResolverListener)
. Implementors must override at least one of the sendAsync
methods or
a stack overflow will occur.
query
- The query to send.default CompletionStage<Message> sendAsync(Message query, Executor executor)
The default implementation calls the deprecated sendAsync(Message,
ResolverListener)
. Implementors must override at least one of the sendAsync
methods or
a stack overflow will occur.
query
- The query to send.executor
- The service to use for async operations.@Deprecated default Object sendAsync(Message query, ResolverListener listener)
sendAsync(Message)
The default implementation calls sendAsync(Message)
. Implementors must override at
least one of the sendAsync
methods or a stack overflow will occur.
query
- The query to sendlistener
- The object containing the callbacks.Copyright © 2022 dnsjava.org. All rights reserved.