s += "&" + InvokerLocator.CLIENT_LEASE + "=true";
   private void initializeRemoting(MBeanServer mbeanServer) throws Exception   {      // We explicitly associate the datatype "jms" with the java SerializationManager      // This is vital for performance reasons.      SerializationStreamFactory.setManagerClassName(         "jms", "org.jboss.remoting.serialization.impl.jboss.JBossSerializationManager");      JMSWireFormat wf = new JMSWireFormat();      MarshalFactory.addMarshaller("jms", wf, wf);            // first remove the invocation handler specified in the config      // TODO: Why removing this? Isn't ServerPeer.stopService() supposed to remove it?      //       If it doesn't, fix ServerPeer.stopService(), don't add unnecessary behavior here.      mbeanServer.invoke(connectorName, "removeInvocationHandler",                         new Object[] { REMOTING_JMS_SUBSYSTEM },                         new String[] { "java.lang.String" });      // add the JMS subsystem invocation handler      handler = new JMSServerInvocationHandler();      mbeanServer.invoke(connectorName, "addInvocationHandler",                         new Object[] { REMOTING_JMS_SUBSYSTEM, handler},                         new String[] { "java.lang.String",                                        "org.jboss.remoting.ServerInvocationHandler"});            String s = (String)mbeanServer.getAttribute(connectorName, "InvokerLocator");                  // To turn off remoting leasing need to ensure that the connection listener hasn't been set      // OR set the lease period to zero. Client side pinging is DISABLED by default so even if set      // connection listener on the server side the client won't ping unless add      // InvokerLocator.CLIENT_LEASE is set.      if (remotingConnectionLeasePeriod < 0)      {         log.debug("connection lease period " +  remotingConnectionLeasePeriod +                   ",  NOT activating connection checking");      }      else      {         mbeanServer.            setAttribute(connectorName, new Attribute("LeasePeriod",                  new Long(remotingConnectionLeasePeriod)));                  // install the connection listener that listens for failed connections                  mbeanServer.invoke(connectorName, "addConnectionListener",               new Object[] {connectionManager},               new String[] {"org.jboss.remoting.ConnectionListener"});                  // Enable client side pinging         s += "&" + InvokerLocator.CLIENT_LEASE + "=true";         log.debug("connection lease period " +  remotingConnectionLeasePeriod +                   ",  activated connection checking");      }      locator = new InvokerLocator(s);      // FIXME Note - There seems to be a bug (feature?) in JBoss Remoting which if you specify      // a socket timeout on the invoker locator URI then it always makes a remote call      // even when in the same JVM.      log.debug("LocatorURI: " + getLocatorURI());   }