3 Replies Latest reply on Jan 6, 2005 2:53 PM by tom.elrod

    concurrency using MBean or POJO handler

    mazz

      Now that invocation handlers can be MBeans (feature recently added to the HEAD), I have a question on concurrency.

      How does the connector handle mutiple requests when using either the MBean approach or the "normal" (POJO) invocation handler?

      I assumed that the older way, the Connector would instantiate an invocation handler for each request it got - hence no real threading issues involved there. For each request, a new handler object is created? I don't know if that is true - which is the question. Does the Connector cache a single invocation handler object per subsystem and just synchronize on it or do multiple instances get created?

      Similarly for the MBean approach - if my invocation handler is an MBean, obviously, there's a single MBean instance. How is concurrency handled on the Connector side - or does it rely on the JMX infrastructure and the handler MBean to deal with thread-safety issues?

        • 1. Re: concurrency using MBean or POJO handler

          There is only one handler instance per Connector. Remoting could (and probably would) make calls on the handler concurrently. It is up to the handler implementation to be thread safe. I don't want to impose single thread model on handlers. Same goes for MBean handlers.

          • 2. Re: concurrency using MBean or POJO handler
            mazz

            That should be documented somewhere - probably in the javadocs for the ServerInvocationHandler interface. I was under the assumption that a handler object was created for each request and hence did not need to be thread-safe. Perhaps say something like

            each server invocation handler is instantiated and cached within the connector to which it belongs. Multiple requests may get dispatched to the invocation handler's invoke call; therefore, each server invocation handler implementation must ensure thread safety.


            • 3. Re: concurrency using MBean or POJO handler

              Have added it to wiki and javadocs.