Client client = new Client(locator, ServerPeer.REMOTING_JMS_SUBSYSTEM);  client.connect();  try { byte v = getVersionToUse().getProviderIncrementingVersion();  MessagingMarshallable mm = (MessagingMarshallable) client.invoke(new MessagingMarshallable(v, invocation), null);  ret = mm.getLoad(); } finally { client.disconnect(); }
ret = mm.getLoad();
   public Object invoke(Invocation invocation) throws Throwable   {      if (log.isTraceEnabled()) { log.trace("invoking " + ((MethodInvocation)invocation).getMethod().getName() + " on server"); }      invocation.getMetaData().addMetaData(Dispatcher.DISPATCHER,                                           Dispatcher.OID,                                           new Integer(id), PayloadKey.AS_IS);            String methodName = ((MethodInvocation)invocation).getMethod().getName();            Object ret = null;                  if ("createConnectionDelegate".equals(methodName))      {         // this must be invoked on the same connection subsequently used by the created JMS         // connection         JMSRemotingConnection connection = new JMSRemotingConnection(serverLocatorURI);                  MethodInvocation mi = (MethodInvocation)invocation;                  Client client = connection.getInvokingClient();                  // I will need this on the server-side to create the ConsumerDelegate instance         mi.getMetaData().addMetaData(MetaDataConstants.JMS,                                      MetaDataConstants.REMOTING_SESSION_ID,                                      client.getSessionId(), PayloadKey.AS_IS);                      try         {                        MessagingMarshallable mm =               (MessagingMarshallable)client.invoke(new MessagingMarshallable(getVersionToUse().getProviderIncrementingVersion(), mi), null);                         ret = mm.getLoad();                        ClientConnectionDelegate delegate = (ClientConnectionDelegate)ret;                        delegate.setConnnectionState(connection);         }         catch (Throwable t)         {            connection.close();                        throw t;         }       }      else      {         // this is invoked on its own connection         InvokerLocator locator = new InvokerLocator(serverLocatorURI);                  Client client = new Client(locator, ServerPeer.REMOTING_JMS_SUBSYSTEM);                  client.connect();                  try         {                                                byte v = getVersionToUse().getProviderIncrementingVersion();                        MessagingMarshallable mm = (MessagingMarshallable)               client.invoke(new MessagingMarshallable(v, invocation), null);                        ret = mm.getLoad();         }         finally         {            client.disconnect();         }      }      if (log.isTraceEnabled()) { log.trace("got server response for " + ((MethodInvocation)invocation).getMethod().getName()); }      return ret;   }