You can do this by changing the caching policy on the container configuration in jboss.xml
<jboss> <enterprise-beans> <session> <ejb-name>MySFSB</ejb-name> <configuration-name>No Passivation Stateful SessionBean</configuration-name> ... </session> </enterprise-beans> <container-configurations> <container-configuration extends=''Standard Stateful SessionBean''> <container-name>No Passivation Stateful SessionBean</container-name> <container-cache-conf> <cache-policy>org.jboss.ejb.plugins.NoPassivationCachePolicy</cache-policy> </container-cache-conf> </container-configuration> </container-configurations> </jboss>
The
NoPassivationCachePolicy
is a jboss class that does not attempt to move SFSB instances to disk when they are not used or later remove them altogether if they are too old.
WARNING: This policy does not protect you from
OutOfMemory
if there are too many sessions in memory.
The session will still be removed in the normal ways:
The client does
session.remove()
The session bean throws a
RuntimeException
or
RemoteException
Referenced by:
Comments