7 Replies Latest reply on Mar 12, 2008 11:09 AM by kaja78

    MDB pool configuration & EJB3

    jc7442

      With JBoss 4.0.3 with EJB3, I try to limit the number of concurrent threads using an MDB. The following jboss.xml does not work. Is there any new feature with EJB3 ?


      <jboss>
       <enterprise-beans>
       <message-driven>
       <ejb-name>sample.MDB</ejb-name>
       <configuration-name>MyConfig2</configuration-name>
       </message-driven>
       </enterprise-beans>
       <container-configuration extends="Standard Message Driven Bean">
       <container-name>MyConfig2</container-name>
      <container-pool-conf>
       <MinimumSize>1</MinimumSize>
       <MaximumSize>5</MaximumSize>
       <strictMaximumSize>true</strictMaximumSize>
       <strictTimeout>10000</strictTimeout>
       </container-pool-conf>
       </container-configuration>
      </jboss>


        • 1. Re: MDB pool configuration & EJB3
          jc7442

          It seems that annotation:

          @PoolClass(maxSize=2,value=StrictMaxPool.class)


          solves the problem for my MDB. Is it possible to specify the same thing with XML ?

          • 2. Re: MDB pool configuration & EJB3
            bill.burke

            you can do annotation overrides in the

            ejb3-interceptors-aop.xml

            You have to pick the right "domain" though...apologies for the poor doco.

            • 3. Re: MDB pool configuration & EJB3
              jjklappenbach

              One way is presented in the test classes provided with the source distribution of JBoss 4.0.3SP1. The example uses annotations to configure the pool, but each annotation has its descriptor analog.

              Look for the file StrictlyPooledMDB.java. The lines you will find of interest:

              @PoolClass (value=org.jboss.ejb3.StrictMaxPool.class, maxSize=StrictlyPooledMDB.maxActiveCount, timeout=10000)

              where StrictlyPooledMDB.maxActiveCount is an int defined in the class to establish the maximum number of threads.

              Your milage may vary here, as setting maxSize to low values can result in JMS subsystems exceptions.

              -jjk

              • 4. Re: MDB pool configuration & EJB3

                And in case anyone is wondering. This is how you do the same thing in jboss.xml:

                <?xml version="1.0" encoding="UTF-8"?>
                <jboss
                 xmlns="http://java.sun.com/xml/ns/javaee"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                 http://www.jboss.org/j2ee/schema/jboss_5_0.xsd"
                 version="3.0">
                 <security-domain>java:/jaas/example-domain</security-domain>
                 <enterprise-beans>
                 <message-driven>
                 <ejb-name>sample.MDB</ejb-name>
                 <pool-config>
                 <pool-class>org.jboss.ejb3.StrictMaxPool</pool-class>
                 <pool-max-size>1</pool-max-size>
                 <pool-timeout>5000</pool-timeout>
                 </pool-config>
                 </message-driven>
                 </enterprise-beans>
                </jboss>
                

                BTW thanks for this thread. You saved my bacon. And thanks to Eclipse for having an XML editor that understands xsd. Oh and thanks to JIRA for showing that the xsd existed!

                Finally I'd like to thank my producer... j/k - its late.

                • 5. Re: MDB pool configuration & EJB3
                  wolfc

                  Before you get your hopes up out of old posts, note that pool configurations on a MDB is not the way to go. http://jira.jboss.com/jira/browse/EJBTHREE-890

                  Also note that expiration of messages is an issue. http://jira.jboss.com/jira/browse/EJBTHREE-938

                  • 6. Re: MDB pool configuration & EJB3
                    ejb3workshop

                    I am having a problem following your suggestion. I increased by session size to 20 using :

                    @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "20"


                    but now I get the following exception :

                    Failed to acquire the pool semaphore, strictTimeout=10000


                    A search on the forum suggestion that I need to increase my MDB pool size to boyond the number of the sessions.
                    http://www.jboss.org/index.html?module=bb&op=viewtopic&t=58293

                    However you suggest that this is not the way to go. I tried it and it didn't work. It complained about the jboss.xml file not being correct.

                    Is there another solution to the Failed to acquire the pool semaphore, strictTimeout=10000 ?

                    Thanks
                    Alex

                    • 7. Re: MDB pool configuration & EJB3
                      kaja78