12 Replies Latest reply on Apr 8, 2004 1:45 PM by jae

    how to initialize the size of EJB? Help!

    jamy_blue Newbie

      I want to create a instance of some EJB when JBoss AS starting.
      How can I configurate the max/min size of the EJB?
      In Weblogic AS, I know how to do it. In weblogic-ejb-jar.xml:

      <stateless-session-descriptor>

      <max-beans-in-free-pool>1</max-beans-in-free-pool>
      <initial-beans-in-free-pool>1</initial-beans-in-free-pool>

      </stateless-session-descriptor>

      Can anyone tell me how to realize it on JBoss AS?
      Thanks a lot!

      James

        • 1. Re: how to initialize the size of EJB? Help!
          jae Master

          you need to add the following to the container configuration contained in standardjboss.xml or in the ejb's jboss.xml file.

          • 2. Re: how to initialize the size of EJB? Help!
            jae Master

             

            "jae77" wrote:
            you need to add the following to the container configuration contained in standardjboss.xml or in the ejb's jboss.xml file.

            <container-pool-conf>
            <MinimumSize></MinimumSize>
            <MaximumSize></MaximumSize>
            <strictMaximumSize></strictMaximumSize>
            <strictTimeout></strictTimeout>
            </container-pool-conf>

            min/max size = min / max beans to create

            enable strictMaximumSize = true to set hard limit of ejbs created, false means that maximum will be kept available, but more may be created if needed.

            you can also use the dtds to get this information as well - check out the docs/dtd in your $JBOSS_HOME directory, the html-svg version rocks!

            strictTimeout controls how long the client will wait if strictMaximumSize = true.

            you can also


            hrm - possible forums bug there


            • 3. Re: how to initialize the size of EJB? Help!
              jae Master

               

              <container-pool-conf>
               <MinimumSize></MinimumSize>
               <MaximumSize></MaximumSize>
               <strictMaximumSize></strictMaximumSize>
               <strictTimeout></strictTimeout>
              </container-pool-conf>


              ok - sorry for all the spam this caused - not sure if there is a bug w/ the xml rendering or not.

              ---
              the above xml needs to be added to either the standardjboss.xml file or the ejb's jboss.xml file.

              you can also check out the dtds in your JBOSS_HOME directory - the svg versions rock!


              • 4. Re: how to initialize the size of EJB? Help!
                jae Master

                no forum bug :) the tag got messed up.

                • 5. Re: how to initialize the size of EJB? Help!
                  jamy_blue Newbie

                  Hi jae77, thank you for your reply.

                  I try what you said. I add those into the ejb's jboss.xml and standardjboss.xml. But it seem dosen't work :(

                  <container-configurations>
                  <container-configuration>
                  <container-name>Standard Stateless SessionBean</container-name>


                  <container-pool-conf>
                  1
                  1
                  true


                  </container-pool-conf>

                  </container-configuration>

                  </container-configurations>

                  Can you help me?
                  Thanks again.

                  • 6. Re: how to initialize the size of EJB? Help!
                    jamy_blue Newbie

                     

                    <container-configurations>
                     <container-configuration>
                     <container-name>Standard Stateless SessionBean</container-name>
                    
                    
                     <container-pool-conf>
                     <MinimumSize>1</MinimumSize>
                     <MaximumSize>1</MaximumSize>
                     <strictMaximumSize>true</strictMaximumSize>
                    
                    
                     </container-pool-conf>
                    
                     </container-configuration>
                    
                     </container-configurations>
                    


                    • 7. Re: how to initialize the size of EJB? Help!
                      jae Master

                      you only really need to add the entry into one location, or the other. specifying it in the standardjboss.xml file means it's a global configuration.

                      specifying in the jboss.xml means it's specific to only that set of ejbs.

                      can you post the entire contents of your jboss.xml file?

                      • 8. Re: how to initialize the size of EJB? Help!
                        jamy_blue Newbie

                        Here is the jboss.xml of the EJBs


                        <?xml version="1.0" encoding="UTF-8"?>
                        <!DOCTYPE jboss PUBLIC '-//JBoss//DTD JBOSS 3.0//EN' 'http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd'>

                        <jboss>
                        <enterprise-beans>
                        <session>
                        <ejb-name>StartupSession</ejb-name>
                        <local-jndi-name>StartupSessionLocal</local-jndi-name>
                        <ejb-local-ref>

                        <ejb-ref-name>ejb/RDISQLRuntimeManagerBean</ejb-ref-name>
                        <local-jndi-name>RDISQLRuntimeManagerBeanLocal</local-jndi-name>
                        </ejb-local-ref>
                        </session>
                        </enterprise-beans>

                        <container-configurations>
                        <container-configuration>
                        <container-name>Standard Stateless SessionBean</container-name>

                        <container-cache-conf>
                        <cache-policy>org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy</cache-policy>
                        <cache-policy-conf>
                        <max-cache-miss-period>1</max-cache-miss-period>
                        <min-cache-miss-period>1</min-cache-miss-period>
                        </cache-policy-conf>
                        </container-cache-conf>
                        <container-pool-conf>
                        <MinimumSize>1</MinimumSize>
                        <MaximumSize>1</MaximumSize>
                        <strictMaximumSize>true</strictMaximumSize>

                        </container-pool-conf>

                        </container-configuration>

                        </container-configurations>
                        </jboss>


                        Pls check the file, thank you very much!

                        • 9. Re: how to initialize the size of EJB? Help!
                          jamy_blue Newbie

                          Sorry, wrong paste, here :

                          <jboss>
                           <enterprise-beans>
                           <session>
                           <ejb-name>StartupSession</ejb-name>
                           <local-jndi-name>StartupSessionLocal</local-jndi-name>
                           <ejb-local-ref>
                          
                           <ejb-ref-name>ejb/RDISQLRuntimeManagerBean</ejb-ref-name>
                           <local-jndi-name>RDISQLRuntimeManagerBeanLocal</local-jndi-name>
                           </ejb-local-ref>
                           </session>
                           </enterprise-beans>
                          
                           <container-configurations>
                           <container-configuration>
                           <container-name>Standard Stateless SessionBean</container-name>
                          
                           <container-pool-conf>
                           <MinimumSize>1</MinimumSize>
                           <MaximumSize>1</MaximumSize>
                           <strictMaximumSize>true</strictMaximumSize>
                          
                           </container-pool-conf>
                          
                           </container-configuration>
                          
                           </container-configurations>
                          </jboss>
                          


                          • 10. Re: how to initialize the size of EJB? Help!
                            squeak Newbie

                            Per page 270 of the Admin and Devel guide, JBoss AS does not pre-seed the pool to the minimum size at startu-up -- if that is what you are trying to accomplish.

                            The MinimumSize element gives the minimum number of instances to keep in the pool, although JBoss does not currently seed an InstancePool to the MinimumSize value.



                            • 11. Re: how to initialize the size of EJB? Help!
                              Anodos Newbie

                              I'm in the same boat as the author of this thread. I know that the JBoss manual says JBoss does not preseed the pool... but maybe someone knows of a trick to get the desired effect? Maybe now is a good time to add the preseed ability to JBoss? :-)

                              • 12. Re: how to initialize the size of EJB? Help!
                                jae Master

                                you could create an mbean that loops over some create calls once the ejb is deployed (you'd have to make the mbean's deployment dependent upon the ejb deployment).

                                are there specific reasons you're looking to have instances created upfront instead of using lazy instanciation?