4 Replies Latest reply on Nov 23, 2009 2:52 AM by jaikiran pai

    Custom StrictMaxPool settings in ...-aop.xml ignored

    Ralf Battenfeld Apprentice

      Hi

      I have to limit the number of MDB running in parallel. Therefore, I created an own aop file called obe-aop.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <aop xmlns="urn:jboss:aop-beans:1.0">
      
       <domain name="OBE-Singleton-Stateless-Session-Bean" extends="Stateless Bean"
       inheritBindings="true">
       <annotation expr="!class(@org.jboss.ejb3.annotation.Pool)">
       @org.jboss.ejb3.annotation.Pool (value="StrictMaxPool", maxSize=1, timeout=10000)
       </annotation>
       </domain>
      
       <domain name="OBE-Singleton-Message-Driven-Bean" extends="Message Driven Bean"
       inheritBindings="true">
       <annotation expr="!class(@org.jboss.ejb3.annotation.Pool)">
       @org.jboss.ejb3.annotation.Pool (value="StrictMaxPool", maxSize=1, timeout=10000)
       </annotation>
      
       </domain>
      </aop>
      


      The limitatiob works fine for stateless session beans but not for MDBs. The only way which works is the chenge the settings in the ejb3-interceptors-aop.xml file.

      At the moment this is ok but I would prefer to be able to adjust it individually for each MDB.

      Thanks a lot for any help
      Ralf

        • 2. Re: Custom StrictMaxPool settings in ...-aop.xml ignored
          Shreyas Shinde Newbie

          I am trying to use StrictMaxPool in JBoss 5.1.0.GA and the properties in the -aop.xml file seem to be ignored. This is for a stateless session bean.

          The EJB3 container seems to honor only the properties in ejb3-interceptors-aop.xml. Any -aop.xml bundled with the EJB application seem to be ignored.

          Any ideas what I could be missing?

          Thanks,

          Shreyas

          jboss.xml:

          <?xml version="1.0" encoding="UTF-8" standalone="no"?>
          <jboss xmlns="http://www.jboss.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5.0" xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss_5_0.xsd">
           <enterprise-beans>
           <session>
           <ejb-name>ClusterOne.USA_MAP.MapServer</ejb-name>
           <jndi-name>esri/services/ClusterOne/MapServer/USA_MAP</jndi-name>
           <clustered>true</clustered>
           <cluster-config>
           <partition-name>ClusterOne</partition-name>
           <load-balance-policy>org.jboss.ha.framework.interfaces.RoundRobin</load-balance-policy>
           </cluster-config>
           <aop-domain-name>Strictly Pooled Stateless Bean</aop-domain-name>
           </session>
           </enterprise-beans>
          </jboss>
          


          mydomain-aop.xml:
          <?xml version="1.0" encoding="UTF-8"?>
          <aop xmlns="urn:jboss:aop-beans:1.0">
          
           <domain name="Strictly Pooled Stateless Bean" extends="Stateless Bean" inheritBindings="true">
           <annotation expr="!class(@org.jboss.ejb3.annotation.Pool)">
           @org.jboss.ejb3.annotation.Pool (value="StrictMaxPool", maxSize=10, timeout=10000)
           </annotation>
           </domain>
          
           <domain name="Strictly Pooled Message Driven Bean" extends="Message Driven Bean" inheritBindings="true">
           <annotation expr="class(*) AND !class(@org.jboss.ejb3.annotation.Pool)">
           @org.jboss.ejb3.annotation.Pool (value="StrictMaxPool", maxSize=10, timeout=10000)
           </annotation>
           </domain>
          </aop>
          


          • 3. Re: Custom StrictMaxPool settings in ...-aop.xml ignored
            Shreyas Shinde Newbie

            Okay. I have a solution for this. It turns out that when EJBs applications are deployed, the properties in ejb3-interceptors-aop.xml file under the deploy directory are applied first. The following annotation in the file says "if the class is not present then apply this property.

            <annotation expr="class(*) AND !class(@org.jboss.ejb3.annotation.Pool)">
             @org.jboss.ejb3.annotation.Pool (value="ThreadlocalPool", maxSize=20, timeout=10000)
             </annotation>
            


            So, when I was bundling my -aop.xml file with my EJB application, the property should read:


            <annotation expr="class(@org.jboss.ejb3.annotation.Pool)">
             @org.jboss.ejb3.annotation.Pool (value="StrictMaxPool", maxSize=10, timeout=10000)
             </annotation>
            


            Which means, if the class is present then apply this property. As the properties from ejb3-interceptors-aop.xml file are always applied first, the class is present and therefore we only check for its existence.

            Most of the documentation is misleading in a way that this point is not very clear.

            Thanks,

            Shreyas

            • 4. Re: Custom StrictMaxPool settings in ...-aop.xml ignored
              jaikiran pai Master

               

              "shreyasshinde" wrote:
              It turns out that when EJBs applications are deployed, the properties in ejb3-interceptors-aop.xml file under the deploy directory are applied first.


              That's because, your configuration instructs the container to do so:

              <domain name="Strictly Pooled Stateless Bean" extends="Stateless Bean" inheritBindings="true">
              


              Notice the "extends". You have instructed that your domain extends the Stateless Bean domain which comes from ejb3-interceptors-aop.xml