1 Reply Latest reply on Jan 24, 2011 11:02 PM by Ron Sigal

    Remoting 2 bug: No reuse of ClientInvoker with params invokerDestructionDelay and socketFactoryClassName

    Patrick Speer Newbie



      I think I found a bug in InvokerRegistry.createClientInvoker(InvokerLocator locator, Map configuration) which leads to superflous instances of ClientInvoker (and therefore no reusing of an existing one).


      I'm using JBoss AS 4.2.2.GA with JBoss Remoting 2.2.3-SP2. My ClientInvoker is configured via params with the following options:


      <attribute name="socketFactoryClassName" isParam="true">package.of.MySSLSocketFactory</attribute>
      <attribute name="invokerDestructionDelay" isParam="true">30000</attribute>


      I was wondering why my application opened up new sockets for every remote call. The problem is, that for every call a new ClientInvoker is created and no reusing takes place:


      In class InvokerRegistry.createClientInvoker line "ClientInvoker invoker = getRegisteredClientInvoker(locator, configuration);" checks for a suitable Invoker. If none is found, a new invoker is created and via "addRegisteredClientInvoker(invoker, l, configuration);" added to the holderList of the clientLocator. The problem is, that e.g. the constructor of RemoteClientInvoker modifies the configuration map. Then this modified map is passed to addRegisteredClientInvoker. But this map is used to identifiy the specific invoker in getRegisteredClientInvoker => so getRegisteredClientInvoker will never return an existing invoker.


      Attached is a patch which fixes this problem. This all sounds a little bit confused, but I'm sure, if you have a look at the attached patch, you will understand my problem.