user manual

130 BES Developers Guide
Sessions in secondary storage
Setting the keep alive timeout for a particular session bean
You may wish to have certain session beans hosted in your container have
their passivated states stored for greater or lesser periods of time than others.
You can use the <timeout> element in the ejb-borland.xml file to set the keep
alive timeout for a particular bean. The DTD element for a session bean
provides this element:
<!ELEMENT session (ejb-name, bean-home-name?, bean-local-home-name?,
timeout?,
ejb-ref*, elb-local-ref*, resource-ref*, resource-env-ref*, property*)>
For example, let's say we have a simple stateful session bean called
personInfo collecting a bit of personal information for simple message forum.
We might be inclined to keep this session highly-available, without aggressive
passivation, and have little need to store it in our database for more than a few
minutes if it passivates. Since the rest of our session beans need to be kept in
stateful storage a bit longer if they passivate, we'll use the Borland-specific
deployment descriptor for the bean's JAR to set a shorter keep alive timeout,
say 300 seconds (five minutes). In our ejb-borland.xml deployment descriptor,
we'd have the following:
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>personInfo</ejb-name>
<timeout>300</timeout>
</session>
</enterprise-beans>
</ejb-jar>
This value will override any values we entered in the ejbcontainer.properties
file while allowing other hosted sessions to use the default value found there.