7 Replies Latest reply on Aug 10, 2011 5:54 AM by jaikiran pai

    Session bean pooling

    Stian Thorgersen Novice

      I have an application that works fine in AS6 under stress testing, but in AS7 it doesn't. The problem on the surface is that the connection pool for the database is exhausted, which causes Hibernate SessionFactory#openSession to throw an exception.

       

      Under the surface it seems Hibernate Sessions aren't being closed as the threads are waiting in StrictMaxPool (org.jboss.ejb3.pool.strictmax.StrictMaxPool.get).

       

      First question: Am I right in understanding that ThreadLocalPool used to be the default pool in AS6, and that has changed to StrictMaxPool in AS7?

       

      Second question: How can I change (or configure) the global pool for session beans? I would like to be able to test whether or not my application works in AS7 with ThreadLocalPool (or alternatively with a higher max size for the StrictMaxPool) without having to add annotations to every single bean.

        • 1. Re: Session bean pooling
          jaikiran pai Master

          Stian Thorgersen wrote:

           

           

           

          First question: Am I right in understanding that ThreadLocalPool used to be the default pool in AS6, and that has changed to StrictMaxPool in AS7?

          Yes, that's correct.

           

           

          Stian Thorgersen wrote:

           

          Second question: How can I change (or configure) the global pool for session beans? I would like to be able to test whether or not my application works in AS7 with ThreadLocalPool (or alternatively with a higher max size for the StrictMaxPool) without having to add annotations to every single bean.

          We currently are working on making that available soon in one of the upcoming releases.

          1 of 1 people found this helpful
          • 2. Re: Session bean pooling
            Stian Thorgersen Novice

            Just out of curiosity, do you know why it was changed to StrictMaxPool?

            • 3. Re: Session bean pooling
              Stian Thorgersen Novice

              I've tried to configure the pool to use ThreadLocalPool with the @Pool annotation, but it doesn't seem to work.

               

              @org.jboss.ejb3.annotation.Pool(value="org.jboss.ejb3.pool.ThreadLocalPool")
              public class ...
              

               

              in fact even with a bogus value ("NoSuchPool") there are no warnings or errors!

               

              Is it at all possible to change the session bean pooling to ThreadLocalPool, or alternatively configure the maximum size of the StrictMaxPool? Without this I simply can't use AS7 as my application keeps locking up and eventually throws "Failed to obtain permitt" exceptions.

              • 4. Re: Session bean pooling
                jaikiran pai Master

                Like I said, the pooling isn't configurable for now. I'm currently working on that and will be available in the upcoming releases (either 7.0.1 or later).

                • 5. Re: Session bean pooling
                  jaikiran pai Master

                  Stian Thorgersen wrote:

                   

                  Just out of curiosity, do you know why it was changed to StrictMaxPool?

                   

                  We have had some problems in the past with ThreadLocalPool http://community.jboss.org/thread/110175?tstart=0

                  1 of 1 people found this helpful
                  • 6. Re: Session bean pooling
                    Stian Thorgersen Novice

                    I misunderstood you, I thought it was only the global configuration that didn't work and it would work with annotations.

                     

                    I've got things working now by patching the EJB module. I've basically replaced "org.jboss.ejb3.pool.strictmax.StrictMaxPool" with "org/jboss/ejb3/pool/threadlocal/ThreadLocalPool". With this patch in place my stress tests pass fine on AS7, so I've got a temporary solution until its possible to configure the pool.

                     

                    Thanks for your help as it's saved me a lot of time trying to hunt for how to configure this. Maybe it would be worth putting a note in the migration guide from AS5/AS6 to AS7 to mention that the default pool has changed, as I could see this causing problems for other users as well.

                    • 7. Re: Session bean pooling
                      jaikiran pai Master

                      Stian, you should now be able to configure pooling configuration at the subsystem level. See this thread for more details http://community.jboss.org/thread/170725