コード例 #1
0
 /**
  * Asynchronously sends a message to multiple servers, potentially multiple times, registering a
  * listener to receive a callback on success or exception. Multiple asynchronous lookups can be
  * performed in parallel. Since the callback may be invoked before the function returns, external
  * synchronization is necessary.
  *
  * @param query The query to send
  * @param listener The object containing the callbacks.
  * @return An identifier, which is also a parameter in the callback
  */
 public Object sendAsync(final Message query, final ResolverListener listener) {
   Resolution res = new Resolution(this, query);
   res.startAsync(listener);
   return res;
 }
コード例 #2
0
 /**
  * Sends a message and waits for a response. Multiple servers are queried, and queries are sent
  * multiple times until either a successful response is received, or it is clear that there is no
  * successful response.
  *
  * @param query The query to send.
  * @return The response.
  * @throws IOException An error occurred while sending or receiving.
  */
 public Message send(Message query) throws IOException {
   Resolution res = new Resolution(this, query);
   return res.start();
 }