Class 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.
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Collector

        Collector()
        Constructor.
        Parameters:
        nExpected - number of responses expected by this collector
    • 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's reply method at some future point.
        Specified by:
        receiveCall in interface CallableClient
        Parameters:
        senderId - public ID of sending client
        msgId - message identifier for later use with reply
        msg - 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 interface CallableClient
        Parameters:
        senderId - public ID of sending client
        msg - 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 interface CallableClient
        Parameters:
        responderId - public ID of responding client
        msgTag - client-defined tag labelling previously-sent message
        response - returned response object