Class ProxyManager.ProxyCallableClient

  • All Implemented Interfaces:
    CallableClient
    Enclosing class:
    ProxyManager

    private class ProxyManager.ProxyCallableClient
    extends java.lang.Object
    implements CallableClient
    CallableClient implementation used by remote proxy connections on behalf of local clients. This is the core of the proxy manager. Callbacks received by the remote proxy client are tunnelled back to the local hub and forwarded by the local proxy of the remote sender client to the appropriate local non-proxy client. Since local proxies are managed by other proxy managers (this one manages remote proxies of local clients) this means getting the other proxy managers to do some of the work.
    • Field Detail

      • localClientId_

        private final java.lang.String localClientId_
    • Constructor Detail

      • ProxyCallableClient

        ProxyCallableClient​(Client localClient,
                            HubConnection remoteProxy,
                            ProxyManager remoteManager)
        Constructor.
        Parameters:
        localClient - local client
        remoteProxy - hub connection to the remote hub for the proxy
        remoteManager - remote ProxyManager associated with the hub where this proxy is connected
    • Method Detail

      • receiveCall

        public void receiveCall​(java.lang.String remoteSenderId,
                                java.lang.String remoteMsgId,
                                Message msg)
                         throws SampException
        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:
        remoteSenderId - public ID of sending client
        remoteMsgId - message identifier for later use with reply
        msg - message
        Throws:
        SampException
      • receiveResponse

        public void receiveResponse​(java.lang.String remoteResponderId,
                                    java.lang.String remoteMsgTag,
                                    Response response)
                             throws SampException
        Description copied from interface: CallableClient
        Receives a response to a message previously sent by this client.
        Specified by:
        receiveResponse in interface CallableClient
        Parameters:
        remoteResponderId - public ID of responding client
        remoteMsgTag - client-defined tag labelling previously-sent message
        response - returned response object
        Throws:
        SampException
      • getLocalProxy

        private HubConnection getLocalProxy​(java.lang.String remoteClientId)
        Returns the hub connection for the proxy on the local hub which corresponds to a given remote client.
        Parameters:
        remoteClientId - client ID of remote client
        Returns:
        hub connection for local proxy
      • proxyProcessMessage

        private void proxyProcessMessage​(java.lang.String remoteSenderId,
                                         Message msg)
        Performs housekeeping tasks for an incoming message if any. This is in addition to forwarding the message to the client for which we are proxying.
        Parameters:
        remoteSenderId - id of sending client on remote hub
        msg - message