For stateless session beans, what is the mechanism of creating and destroying?


1- in the specs: the container can invoke the instance creation at any time not related to a client calling the create method: how is this decided by the container?
2- when the container no longer needs the instance it destroys it. How does the container decide that it doesn't need the instance?
3- what is the capacity of poolings?

Currently the Container has a rather simple approach to stateless session beans. It creates as many session beans as are needed to support every concurrent use. So, if three clients simultaneously call a session bean, three instances are used. Stateless session beans do not have a timeout in EJB. Thus, they will never actually be removed. They remain in a pool to be ready to serve future requests on the bean.

Note that in practice one needs one thread per access to an EJB object, so one will run out of memory for threads long before one will run out of memory for beans. So, we believe not bounding or compacting the pool is not a serious problem.