3 Replies Latest reply on Feb 13, 2006 9:39 AM by borje.jonsson

    Concurrent call to the same sessionbean

    borje.jonsson

      Hello,

      If i have the following code:

      ReaderHome home = (Home) PortableRemoteObject.narrow(o, ReaderHome.class);
      Reader rd = home.create();
      rd.readRates();
      


      The client then retains a reference to the remote interface, rd.
      Then it makes several concurrent calls (from different threads) to rd.readRates().

      Does these calls get serialized to the same sessionbean instance?

      Do i have to call home.create() for every call to get concurrency at all?

      He reason i ask is that we have an application where the client can be located many router hops away from the server and we have still have to handle several thousand calls every minute. To avoid one more call is seen as nessary for performance.

      /BJ

        • 1. Re: Concurrent call to the same sessionbean
          acoliver

          First off just so you know, there is no need to do PortableRemoteObject with JBoss (though doing so may help your portability to inferior appservers or if you think you may really actually use corba).

          Each call on a STATELESS sesion bean will go to a different instance from the pool (per spec). There is absolutely no need to call to home.create for each call (and doing so has negative characteristics if you do clustering later).

          STATEFUL session beans throw an exception if you try and make concurrent calls on the same instance.

          • 2. Re: Concurrent call to the same sessionbean
            acoliver

            moreover if you're doing a new app you may want to investigate jboss's ejb3 container as it uses jboss serialization/remoting by default which is much lighter weight in transmission cost.

            • 3. Re: Concurrent call to the same sessionbean
              borje.jonsson

              Thanks for the reply. I will look into ejb3 in the future, for now we will use rmi.

              /BJ