public interface IGetDNSContextAsyncWithCallback
This interface is for calling the API asynchronously using a callback mechanism.
Modifier and Type | Method and Description |
---|---|
java.lang.Long |
addressAsync(java.lang.String name,
java.util.HashMap<ExtensionName,java.lang.Object> extensions,
IGetDNSCallback callback)
This API call takes argument only as a host name.
|
void |
cancelRequest(java.lang.Long transactionId)
This function uses the transaction_id to determine which callback is to be cancelled.
|
void |
close()
This method is used to close the current context.
|
java.lang.Long |
generalAsync(java.lang.String name,
RRType requestType,
java.util.HashMap<ExtensionName,java.lang.Object> extensions,
IGetDNSCallback callback)
This API call is used for looking up any type of DNS record.
|
java.lang.Long |
hostnameAsync(java.lang.String address,
java.util.HashMap<ExtensionName,java.lang.Object> extensions,
IGetDNSCallback callback)
This API call takes both IPV4 AND IPV6 address.
|
void |
run()
This method is used to wait for completion of pending DNS requests and populate the response in the future objects.
|
java.lang.Long |
serviceAsync(java.lang.String name,
java.util.HashMap<ExtensionName,java.lang.Object> extensions,
IGetDNSCallback callback)
This API call takes arguments as a domain name for an SRV lookup.
|
void |
setExecutor(java.util.concurrent.ExecutorService executor)
This function is used to set a threadpool executor to execute the callback.
|
java.lang.Long addressAsync(java.lang.String name, java.util.HashMap<ExtensionName,java.lang.Object> extensions, IGetDNSCallback callback) throws GetDNSException
This API call takes argument only as a host name.
There are three critical differences between addressAsync() and GeneralAsync() beyond the missing request_type argument:
name
- a representation of the query term; usually a string but must be a
dict (as described below) in the case of a PTR record lookupextensions
- (optional) a dictionary containing attribute/value pairscallback
- to handle responseGetDNSException
void cancelRequest(java.lang.Long transactionId) throws GetDNSException
This function uses the transaction_id to determine which callback is to be cancelled. If the function fails, transaction_id is set to 0.
transactionId
- GetDNSException
java.lang.Long generalAsync(java.lang.String name, RRType requestType, java.util.HashMap<ExtensionName,java.lang.Object> extensions, IGetDNSCallback callback) throws GetDNSException
This API call is used for looking up any type of DNS record.
context.generalAsync("getdnsapi.net", RRType.valueOf("A"), null, new IGetDNSCallback() {
public void handleResponse(HashMap<String, Object> response, RuntimeException exception) {
checkResponse(domain, "A", response);
});
context.run();
});
name
- a representation of the query term; usually a string.requestType
- a DNS RR type as a getdns constant (listed here)extensions
- (optional) a dictionary containing attribute/value pairscallback
- to handle responseGetDNSException
java.lang.Long hostnameAsync(java.lang.String address, java.util.HashMap<ExtensionName,java.lang.Object> extensions, IGetDNSCallback callback) throws GetDNSException, java.net.UnknownHostException
This API call takes both IPV4 AND IPV6 address.
address
- IPV4 or IPV6 Addressextensions
- (optional) a dictionary containing attribute/value pairscallback
- to handle responseGetDNSException
java.net.UnknownHostException
void run()
java.lang.Long serviceAsync(java.lang.String name, java.util.HashMap<ExtensionName,java.lang.Object> extensions, IGetDNSCallback callback) throws GetDNSException
name
- a representation of the query term; usually a string but must be a
dict (as described below) in the case of a PTR record lookupextensions
- (optional) a dictionary containing attribute/value pairscallback
- to handle responseGetDNSException
void setExecutor(java.util.concurrent.ExecutorService executor)
This function is used to set a threadpool executor to execute the callback.
executor
- void close()