0 Replies Latest reply on Oct 25, 2010 10:34 AM by mikka2010

    Stateful Bean - Timeout put bean in pool

    mikka2010

      Hello,

       

      I have observed a strange behaviour of my simple stateful bean.

       

      For testing I annotated my bean class like this:

      @CacheConfig (maxSize=100, idleTimeoutSeconds=30, removalTimeoutSeconds=30)

       

      If the client creates and destroys my stateful bean, everything works fine.  After creation the bean is held in the cache until it is passivated or  the client executes the beans remove-Method, which executes the  ejbRemove-Method.

       

      But if I simulate a client crash, so that the bean is  passivated after 30 seconds of inactivity and then destroyed after  further 30 seconds. (only the ejbRemove-Method is called) The bean is  still available in memory, because it is only transfered from the cache  to the pool.

       

      In the file ejb3-interceptors-aop.xml I configured the pool size like this for "Base Stateful Bean"

      <annotation expr="!class(@org.jboss.annotation.ejb.PoolClass)">
        @org.jboss.annotation.ejb.PoolClass (value=org.jboss.ejb3.ThreadlocalPool.class, maxSize=3, timeout=100)        
      </annotation>

       

      After starting and crashing 5 Clients, eclipse shows the following pool's attributes:

      maxSize = 3

      inUse = 5

       

      The content of the pool is never reduced. The underlying LinkedList always contains 5 entries.

       

      Why  is the bean transfered from the cache to pool in case of a timeout and  why is the bean not destroyed in the same way as it is done, when the  client calls the remove-Method? Why is the pool ever used in case of timeout?

       

      I thought that statful beans don't use a pool. My understanding is that stateful beans only use the cache until they are active.

       

      Kind regards,

      Huber