8 Replies Latest reply on Aug 8, 2006 4:26 PM by jc7442

    Setting timeout for EJB3 session beans

      Hi all,

      I am a little bit confused about setting timeout for EJB3 session beans. I searched all the web and the jboss forums, but get no answers.

      I tried to configure the timeout in the standardjboss.xml with no effect. A setting of the parameter <remover-period>, <max-bean-life>, <overager-period> and <max-bean-age> in diverse container configuration to lower values seemed to be ignored.
      I didn't find a configuration file for EJB3 to set this values.

      I noticed the a "job" passivate all 10 minutes my inacitve SFSB.

      Therefore my questions:
      Does EJB3-SFSB uses the standardjboss.xml configuration?
      Is their a special configuration file for EJB3 and where is it?
      How can I specify the timeout for a SFSB?

      Thanks in advance for your answers,
      Marco

        • 1. Re: Setting timeout for EJB3 session beans
          jc7442

          There is a Timeout annotation you can add for one specific ejb3.

          You can also set a glocal properties in ejb3.deployer/META-INF/jboss-service.xml (I don't remember the syntax but it was somewhere in old thread of this forum)

          • 2. Re: Setting timeout for EJB3 session beans

            Thank you jc7442 for your reply.

            I looked also on the ejb3.deployer/META-INF/jboss-service.xml but I found no hint, how to configure this.

            I seached the forum for you hint about the configuration values. All I found was the follow posting:
            http://www.jboss.com/index.html?module=bb&op=viewtopic&t=82861.

            Is this the posting you mean?
            But I'm not sure how to set this values. Is there a documentation. Is there a wiki page about this values? I didn't find one.

            Regards
            Marco

            • 3. Re: Setting timeout for EJB3 session beans

              You can change the timeout in
              $JBOSS_HOME\server\default\conf\standardjboss.xml

              Look for

              <container-configuration>
              <container-name>Standard Stateful SessionBean</container-name>
              ...
              <container-cache-conf> <cache-policy>org.jboss.ejb.plugins.LRUStatefulContextCachePolicy</cache-policy>
              <cache-policy-conf>
              <min-capacity>50</min-capacity>
              <max-capacity>1000000</max-capacity>
              <remover-period>1800</remover-period>
              <max-bean-life>1800</max-bean-life>
              <overager-period>300</overager-period>
              <max-bean-age>600</max-bean-age>
              <resizer-period>400</resizer-period>
              <max-cache-miss-period>60</max-cache-miss-period>
              <min-cache-miss-period>1</min-cache-miss-period>
              <cache-load-factor>0.75</cache-load-factor>
              </cache-policy-conf>
              </container-cache-conf>


              Set the max-bean-age.

              Hope this helps.

              • 4. Re: Setting timeout for EJB3 session beans
                wolfc

                standardjboss.xml is ignored by EJB3 beans.

                Please try:

                @CacheConfig(idleTimeoutSeconds=300)


                • 5. Re: Setting timeout for EJB3 session beans

                  Thanks you wolfc.

                  I will try this.

                  But is there another way to configure the timeout not using annotations? I found the solution for EJB3 to override the configuration from the standardjboss.xml in my local jboss.xml a good solution. If I use annotition I'll have to make all changes in all classes and not in one configuration file.

                  jc7442 mentioned that there should be way to do this in the ejb3.deployer/META-INF/jboss-service.xml, but it seams that no one knows how to do this !?

                  Regards
                  Marco

                  • 6. Re: Setting timeout for EJB3 session beans

                    Sorry folk, I made a mistake. I meant EJB2 not 3.

                    So the correct comment is:
                    I found the solution for EJB2 to override the configuration from the standardjboss.xml in my local jboss.xml a good solution. If I use annotition I'll have to make all changes in all classes and not in one configuration file.

                    Regards
                    Marco

                    • 7. Re: Setting timeout for EJB3 session beans
                      wolfc

                      To have the thread complete: for EJB3 you can modify ejb3-interceptors-aop.xml.

                      • 8. Re: Setting timeout for EJB3 session beans
                        jc7442