org.jdesktop.wonderland.client.comms
Class WaitResponseListener

java.lang.Object
  extended by org.jdesktop.wonderland.client.comms.WaitResponseListener
All Implemented Interfaces:
ResponseListener
Direct Known Subclasses:
OKErrorResponseListener

public class WaitResponseListener
extends java.lang.Object
implements ResponseListener

A response listener super type that lets users register a listener for a response message.

Author:
kaplanj

Constructor Summary
WaitResponseListener()
           
 
Method Summary
protected  void notifyResponse(ResponseMessage response)
          Notify that a message is received.
 void responseReceived(ResponseMessage response)
          Called when the response to a message is received
 ResponseMessage waitForResponse()
          Wait for a response to the message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WaitResponseListener

public WaitResponseListener()
Method Detail

responseReceived

public void responseReceived(ResponseMessage response)
Description copied from interface: ResponseListener
Called when the response to a message is received

Specified by:
responseReceived in interface ResponseListener
Parameters:
response - the response message that was received

waitForResponse

public ResponseMessage waitForResponse()
                                throws java.lang.InterruptedException
Wait for a response to the message. This method will return once a response to the given message is received.

Returns:
the ResponseMessage that was received in response to this message
Throws:
java.lang.InterruptedException - if the response is delayed

notifyResponse

protected void notifyResponse(ResponseMessage response)
Notify that a message is received. Subclasses that override the responseReceived() method must call this in order to notify listeners.

Parameters:
response - the response message


Open Wonderland - http://openwonderland.org