6 Replies Latest reply on May 11, 2012 6:34 AM by rjanapala

    Timeout for passivation of stateful beans

    ochaloup

      Hi,

       

      I'm looking for possibility to define timeout for passivation stateful beans. Something similar what was possible in former version of JBoss by annotation @CacheConfig. I would like set timeout after which the server starts passivate beans and define maximal size of cache.

      I have found new EJB 3.1 annotation @StatefulTimeout but it defines time to destroy the bean. I tried to search in cli to but I haven't found out how it could be set.

      Is there some possibility of setting cache behaviour for passivation in AS7?

       

      Thank you

        • 1. Re: Timeout for passivation of stateful beans
          jaikiran

          Ondřej Chaloupka wrote:

           

          Hi,

           

          I'm looking for possibility to define timeout for passivation stateful beans. Something similar what was possible in former version of JBoss by annotation @CacheConfig. I would like set timeout after which the server starts passivate beans and define maximal size of cache.

          Those configurations will have to be done at the subsystem level where the cache is defined. In AS7 it's the infinispan subsystem where the cache is defined. So you'll have to configure it there.

          • 2. Re: Timeout for passivation of stateful beans
            jaikiran

            A quick look at the jboss-as-infinispan_1_1.xsd shows that you might have to use the eviction element with a max-entries sub element for this.

            1 of 1 people found this helpful
            • 3. Re: Timeout for passivation of stateful beans
              ochaloup

              Thank you for showing me right way. It's described in documentation of Infinispan: https://docs.jboss.org/author/display/ISPN/Eviction

              Inthe end I didn't use settings of infinispan because I didn't need any clustering options. I have used an attribute of file-passivation-store. It could be like this:

               

              ...

              <caches>

                <cache name="passivate" passivation-store-ref="filestore" aliases="SimpleStatefulCache"/>

              </caches>

              <passivation-stores>

                <file-passivation-store name="filestore" idle-timeout="10"/>

              </passivation-stores>

              ...

              or via jboss-cli.sh

              /subsystem=ejb3/file-passivation-store=filestore:write-attribute(name="idle-timeout", value="10")

              • 4. Re: Timeout for passivation of stateful beans
                rjanapala

                Hi,

                 

                  I want to configure a Nonpasivated cache for a statefull session bean, the instance in the cache should not be expired(@StatefulTimeoushould be -1). Colud you please help how to configure this in JBOSS AS 7.1

                • 5. Re: Timeout for passivation of stateful beans
                  ochaloup

                  For not not passivated cache try to annotate the stateful bean with:

                  @Cache("simple")

                  This cache should be set in standalone-full.xml in subsystem ejb3. And it's defined as:

                  <cache name="simple" aliases="NoPassivationCache"/>

                  Try to check it.

                  • 6. Re: Timeout for passivation of stateful beans
                    rjanapala

                    Hi Chaloupka,

                     

                    Thanks for the reply,

                     

                     

                      Ya as you said i have tried this but the above configuration will only stop passivatin the statefull session bean, but how can stop removing the bean from cache after it get expired.