[jboss-user] [EJB 3.0] - Stateful Bean - Timeout put bean in pool

Huber Maier do-not-reply at jboss.com
Mon Oct 25 10:34:48 EDT 2010

mikka2010 [http://community.jboss.org/people/mikka2010] created the discussion

"Stateful Bean - Timeout put bean in pool"

To view the discussion, visit: http://community.jboss.org/message/568236#568236


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)         

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,

Reply to this message by going to Community

Start a new discussion in EJB 3.0 at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101025/3788eb42/attachment.html 

More information about the jboss-user mailing list