net.zortrium.p2proto
Interface MsgCallback


public interface MsgCallback

Interface for specifying how to handle the responses of asynchronous messages. Contains separate handlers for successful responses, timeouts, explicit errors, or other IO errors.

Author:
Sean Barker - www.zortrium.net

Method Summary
 void handleException(IOException e)
          Handle any IO exception encountered while sending the query message.
 void handlePeerError(PeerErrorException e)
          Handle an error message response.
 void handlePeerTimeout(PeerTimeoutException e)
          Handle a message response timeout.
 void handleResponse(Msg msg)
          Handle the given response message.
 

Method Detail

handleResponse

void handleResponse(Msg msg)
Handle the given response message. This indicates that a non-error response was successfully received to the query message.

Parameters:
msg - The response message.

handlePeerTimeout

void handlePeerTimeout(PeerTimeoutException e)
Handle a message response timeout. This indicates that no response was received from the remote host in the allotted time.

Parameters:
e - The timeout exception thrown.

handlePeerError

void handlePeerError(PeerErrorException e)
Handle an error message response. This indicates that a response was successfully received, but that the remote host encountered a problem. Note that this does NOT indicate a communication problem with the remote host.

Parameters:
e - The error exception thrown.

handleException

void handleException(IOException e)
Handle any IO exception encountered while sending the query message. This will also include exceptions passed to handlePeerError(PeerErrorException) and handlePeerTimeout(PeerTimeoutException) if those methods are not overridden.

Parameters:
e - The exception that occurred.