2 Replies Latest reply on Aug 9, 2002 8:28 PM by Jon Swinth

    Long transaction causing EJB server single tasking

    mang qin Newbie


      I am using jboss3.0.0 with oracle 817 and struts.
      I have stateless sessionbeans with container managed transaction (Required) and CMP e-beans.

      One of my stateless bean will have a long transaction creating a whole lot of entitybeans. It seems that this long transaction is blocking everything else from happening. Basically any call from the struts app or simple java clients to my ejb server is blocked until this transaction is done.

      Please help.


        • 1. Re: Long transaction causing EJB server single tasking
          mang qin Newbie

          I posted this JBOSS/EJB also. Please help.

          I finally got it to perform somewhat muti-tasking now.
          I am using jboss3 final, and CMP.

          I did it by setting the locking policy to org.jboss.ejb.plugins.lock.MethodOnlyEJBLock and set my stateless bean transaction attribute to requiresnew.
          It looks like long transactions are not blocking other transactions from the users point view. However, transactions are put in a queue and handled in a single task manner.

          I wish someone could tell me how to have these inserts in the transactions happen concurrently.

          I basically have one stateless sessionbean that has a method that does a lot of insert in a container managed transaction (RequiresNew) (10minutes). I have 2 clients calling it, it seems server is doing transaction one by one.

          Some one please help.

          • 2. Re: Long transaction causing EJB server single tasking
            Jon Swinth Newbie

            I have two segestions for you. First, make sure that there is not some common bean that is found and accessed as reference when creating the inserts. This would explain why the transactions are waiting.

            Socond, is it necessary that these many inserts be in the same transaction? If not break up the method into two. The first method should be set to NotSupported and within that method generate an array of info you want to insert. The second method should be set to Required (default) and it would actually do the create of one bean. Make sure to access the second method from the first through sessionContext.getEJBLocalObject() so that JBoss seperates it into a transaction. In this way, each insert is a seperate transaction and any other queries will be folded into the queue during the 10 minutes.

            Contact me by email if I can be of further help.