Look for these entries in your standardjboss.xml:
<instance-pool>org.jboss.ejb.plugins.StatelessSessionInstancePool</instance-pool> ... <container-pool-conf> <MaximumSize>100</MaximumSize> </container-pool-conf>
This person is incorrect...
By default, SLSBs use a ThreadLocal pool. So, one instance is created per thread. TheadLocal pools allow you to avoid synchronization.
So basically, you have, by default as many SLSB instances as your greatest volume of concurrent requests.
Download RC9 release and read the documentation on how to change things. For instance, there is a StrictPool setting that will set a max and block requests if that max is met.
Here I've some problem quite aligned to the subject.
Actually I want to restrict max no of StatefulSessionBean instances in the EJB3.0 configuration. My main objective is to make methods postActivate() (decorated with anno. @PostActivate) and prePassivate (with @PrePassivate) get called, for a test environment.
Please help me with the configuration of EJB3.0.
Thanks & Regards,
You can also set that in the standardjboss.xml file. Just scroll down, till you find that:
<container-configurations> <container-configuration> <container-name>Standard Stateful SessionBean</container-name> ... <overager-period>300</overager-period> <max-bean-age>600</max-bean-age> ...
max-bean-age is the time in seconds, a stateful bean has to be idle before it gets passivated.
the overager-period is the time period, the beans get checked for passivation.
Alternatively, you can copy the whole container configuration to a jboss.xml file which has to be located in the META-INF-Directory of your Bean .jar.
If the pool size for a bean is set to 1, would the second request be blocked or will it simply use the same instance??
I'm trying to share state between stateless beans, and therefore want to set the pool size to 1. However, not if the second/third request is blocked.