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.BlockingMap
map_
(package private) java.util.Collection
recipients_
-
Constructor Summary
Constructors Constructor Description Collector()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
receiveCall(java.lang.String senderId, java.lang.String msgId, Message msg)
Receives a message for which a response is required.void
receiveNotification(java.lang.String senderId, Message msg)
Receives a message for which no response is required.void
receiveResponse(java.lang.String responderId, java.lang.String msgTag, Response response)
Receives a response to a message previously sent by this client.void
setRecipients(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:CallableClient
Receives a message for which a response is required. The implementation must take care to call the hub'sreply
method at some future point.- Specified by:
receiveCall
in 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:CallableClient
Receives a message for which no response is required.- Specified by:
receiveNotification
in 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:CallableClient
Receives a response to a message previously sent by this client.- Specified by:
receiveResponse
in interfaceCallableClient
- Parameters:
responderId
- public ID of responding clientmsgTag
- client-defined tag labelling previously-sent messageresponse
- returned response object
-
-