Package org.astrogrid.samp.test
Class MessageSender.AsynchSender.Collector
- java.lang.Object
-
- org.astrogrid.samp.test.MessageSender.AsynchSender.Collector
-
- All Implemented Interfaces:
CallableClient
- Enclosing class:
- MessageSender.AsynchSender
private static class MessageSender.AsynchSender.Collector extends java.lang.Object implements CallableClient
CallableClient implementation which collects asynchronous message responses.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) MessageSender.BlockingMapmap_(package private) java.util.Collectionrecipients_
-
Constructor Summary
Constructors Constructor Description Collector()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidreceiveCall(java.lang.String senderId, java.lang.String msgId, Message msg)Receives a message for which a response is required.voidreceiveNotification(java.lang.String senderId, Message msg)Receives a message for which no response is required.voidreceiveResponse(java.lang.String responderId, java.lang.String msgTag, Response response)Receives a response to a message previously sent by this client.voidsetRecipients(java.util.Collection recipients)Notifies this object which clients it should expect a response from.
-
-
-
Field Detail
-
map_
final MessageSender.BlockingMap map_
-
recipients_
java.util.Collection recipients_
-
-
Method Detail
-
setRecipients
public void setRecipients(java.util.Collection recipients)
Notifies this object which clients it should expect a response from. Must be called at some point, or the returned map's iterator will block indefinitely.- Parameters:
recipients- set of client ids for expected responders
-
receiveCall
public void receiveCall(java.lang.String senderId, java.lang.String msgId, Message msg)Description copied from interface:CallableClientReceives a message for which a response is required. The implementation must take care to call the hub'sreplymethod at some future point.- Specified by:
receiveCallin interfaceCallableClient- Parameters:
senderId- public ID of sending clientmsgId- message identifier for later use with replymsg- message
-
receiveNotification
public void receiveNotification(java.lang.String senderId, Message msg)Description copied from interface:CallableClientReceives a message for which no response is required.- Specified by:
receiveNotificationin interfaceCallableClient- Parameters:
senderId- public ID of sending clientmsg- message
-
receiveResponse
public void receiveResponse(java.lang.String responderId, java.lang.String msgTag, Response response)Description copied from interface:CallableClientReceives a response to a message previously sent by this client.- Specified by:
receiveResponsein interfaceCallableClient- Parameters:
responderId- public ID of responding clientmsgTag- client-defined tag labelling previously-sent messageresponse- returned response object
-
-