Class MessageTrackerHubConnector.CallAllHandler

  • Enclosing class:
    MessageTrackerHubConnector

    private class MessageTrackerHubConnector.CallAllHandler
    extends java.lang.Object
    Class used to keep track of outgoing callAll() messages. It needs to be able to match Responses with Transmissions, but the complication is that a Response may arrive either before or after its corresponding Transmission is known.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String msgTag_  
      private java.util.Map responseMap_  
      private java.util.Collection transSet_  
    • Constructor Summary

      Constructors 
      Constructor Description
      CallAllHandler​(java.lang.String msgTag)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addResponse​(java.lang.String responderId, Response response)
      Supplies a response to the callAll invocation handled by this object.
      private void processResponse​(java.lang.String responderId, Response response)
      Does the work of passing a received response to the relevant member of the transmission list.
      private void retireIfDone()
      Checks whether this object has any further work to do (any more responses are expected) and if not uninstalls itself, at which point it becomes unreachable and can be garbage collected.
      void setTransmissions​(Transmission[] transmissions)
      Called once when the list of transmissions corresponding to the callAll invocation is known.
      • Methods inherited from class java.lang.Object

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

      • msgTag_

        private final java.lang.String msgTag_
      • responseMap_

        private final java.util.Map responseMap_
      • transSet_

        private java.util.Collection transSet_
    • Constructor Detail

      • CallAllHandler

        CallAllHandler​(java.lang.String msgTag)
        Constructor.
        Parameters:
        msgTag - message tag labelling the callAll send
    • Method Detail

      • setTransmissions

        public void setTransmissions​(Transmission[] transmissions)
        Called once when the list of transmissions corresponding to the callAll invocation is known.
        Parameters:
        transmissions - list of transmission objects, one for each callAll recipient
      • addResponse

        public void addResponse​(java.lang.String responderId,
                                Response response)
        Supplies a response to the callAll invocation handled by this object.
        Parameters:
        responderId - client ID of responder
        response - response
      • processResponse

        private void processResponse​(java.lang.String responderId,
                                     Response response)
        Does the work of passing a received response to the relevant member of the transmission list. May only be called following setTransmissions(org.astrogrid.samp.gui.Transmission[]).
        Parameters:
        responderId - client ID of responder
        response - response
      • retireIfDone

        private void retireIfDone()
        Checks whether this object has any further work to do (any more responses are expected) and if not uninstalls itself, at which point it becomes unreachable and can be garbage collected. May only be called following setTransmissions(org.astrogrid.samp.gui.Transmission[]).