Class HubConnector.CallItem

  • All Implemented Interfaces:
    java.lang.Comparable
    Enclosing class:
    HubConnector

    private class HubConnector.CallItem
    extends java.lang.Object
    implements java.lang.Comparable
    Stores state about a particular set of responses expected by the CallHandler class.
    • Constructor Summary

      Constructors 
      Constructor Description
      CallItem​(ResultHandler handler, long finish)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addResponse​(java.lang.String responderId, Response response)
      Take delivery of a response object.
      int compareTo​(java.lang.Object o)
      Compares on timeout epochs.
      boolean isDone()
      Indicate whether this call item has received all the responses it's going to.
      private void processResponse​(java.lang.String responderId, Response response)
      Process a response when we have both the list of recipients and the response itself.
      void setRecipients​(java.lang.String[] recipientIds)
      Sets the recipient Ids for which responses are expected.
      • Methods inherited from class java.lang.Object

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

      • finish_

        final long finish_
      • responseMap_

        volatile java.util.Map responseMap_
      • recipientMap_

        volatile java.util.Map recipientMap_
    • Constructor Detail

      • CallItem

        CallItem​(ResultHandler handler,
                 long finish)
        Constructor.
        Parameters:
        handler - callback object
        finish - epoch at which timeout should be called
    • Method Detail

      • setRecipients

        public void setRecipients​(java.lang.String[] recipientIds)
        Sets the recipient Ids for which responses are expected.
        Parameters:
        recipientIds - recipient client ids
      • addResponse

        public void addResponse​(java.lang.String responderId,
                                Response response)
        Take delivery of a response object.
        Parameters:
        responderId - client ID of responder
        response - response object
      • processResponse

        private void processResponse​(java.lang.String responderId,
                                     Response response)
        Process a response when we have both the list of recipients and the response itself.
        Parameters:
        responderId - client ID of responder
        response - response object
      • isDone

        public boolean isDone()
        Indicate whether this call item has received all the responses it's going to.
        Returns:
        iff no further activity is expected
      • compareTo

        public int compareTo​(java.lang.Object o)
        Compares on timeout epochs. Implementation is consistent with equals, which means it's OK to use them in a SortedMap.
        Specified by:
        compareTo in interface java.lang.Comparable