Class MessageTrackerHubConnector.MessageTrackerHubConnection

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Client selfClient_  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String call​(java.lang.String recipientId, java.lang.String msgTag, java.util.Map msg)
      Sends a message to a given client expecting a response.
      java.util.Map callAll​(java.lang.String msgTag, java.util.Map msg)
      Sends a message to all subscribed clients expecting responses.
      Response callAndWait​(java.lang.String recipientId, java.util.Map msg, int timeout)
      Sends a message synchronously to a client, waiting for the response.
      (package private) Client getSelfClient()
      Returns a Client object for use in Transmission objects which represents this connection's owner.
      void notify​(java.lang.String recipientId, java.util.Map msg)
      Sends a message to a given client without wanting a response.
      java.util.List notifyAll​(java.util.Map msg)
      Sends a message to all subscribed clients without wanting a response.
      void reply​(java.lang.String msgId, java.util.Map response)
      Supplies a response to a previously received message.
      void setCallable​(CallableClient callable)
      Tells the hub how it can perform callbacks on the client by providing a CallableClient object.
      • Methods inherited from class java.lang.Object

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

      • selfClient_

        private Client selfClient_
    • Constructor Detail

      • MessageTrackerHubConnection

        MessageTrackerHubConnection​(HubConnection base)
        Constructor.
        Parameters:
        base - connection on which this one is based
    • Method Detail

      • getSelfClient

        Client getSelfClient()
        Returns a Client object for use in Transmission objects which represents this connection's owner. This has to be the same object as is used in the client set, otherwise the various models don't get updated correctly. For this reason, it has to be obtained lazily, after the client set has been initialised.
        Returns:
        self client object
      • call

        public java.lang.String call​(java.lang.String recipientId,
                                     java.lang.String msgTag,
                                     java.util.Map msg)
                              throws SampException
        Description copied from interface: HubConnection
        Sends a message to a given client expecting a response. The receiveResponse method of this connection's CallableClient will be called with a response at some time in the future.

        Only permitted if this client is already callable.

        Specified by:
        call in interface HubConnection
        Overrides:
        call in class WrapperHubConnection
        Parameters:
        recipientId - public-id of client to receive message
        msgTag - arbitrary string tagging this message for caller's benefit
        msg - Message-like map
        Returns:
        message ID
        Throws:
        SampException
      • callAll

        public java.util.Map callAll​(java.lang.String msgTag,
                                     java.util.Map msg)
                              throws SampException
        Description copied from interface: HubConnection
        Sends a message to all subscribed clients expecting responses. The receiveResponse method of this connection's CallableClient will be called with responses at some time in the future.

        Only permitted if this client is already callable.

        Specified by:
        callAll in interface HubConnection
        Overrides:
        callAll in class WrapperHubConnection
        Parameters:
        msgTag - arbitrary string tagging this message for caller's benefit
        msg - Message-like map
        Returns:
        public-id->msg-id map for clients to which an attempt to send the call will be made
        Throws:
        SampException
      • callAndWait

        public Response callAndWait​(java.lang.String recipientId,
                                    java.util.Map msg,
                                    int timeout)
                             throws SampException
        Description copied from interface: HubConnection
        Sends a message synchronously to a client, waiting for the response. If more seconds elapse than the value of the timeout parameter, an exception will result.
        Specified by:
        callAndWait in interface HubConnection
        Overrides:
        callAndWait in class WrapperHubConnection
        Parameters:
        recipientId - public-id of client to receive message
        msg - Message-like map
        timeout - timeout in seconds, or <0 for no timeout
        Returns:
        response
        Throws:
        SampException