| Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide 10g (10.1.3.5.0) Part Number E13981-01 |
|
|
View PDF |
You can specify under what conditions OC4J passivates an EJB 3.0 stateful session bean using OC4J-proprietary annotations (see "Using Annotations") or using the orion-ejb-jar.xml file (see "Using Deployment XML").
Configuration in the orion-ejb-jar.xml file overrides the corresponding configuration made using OC4J-proprietary annotations.
For more information, see the following:
You can specify OC4J-proprietary deployment options for an EJB 3.0 stateful session bean using the @StatefulDeployment OC4J-proprietary annotation. Example 5-1 shows how to configure passivation criteria for an EJB 3.0 stateless session bean using the following @StatefulDeployment annotation attributes:
For more information on these @StatefulDeployment attributes, see Table A-1. For more information on the @StatefulDeployment annotation, see "Configuring OC4J-Proprietary Deployment Options on an EJB 3.0 Session Bean".
Example 5-1 Configuring Passivation Criteria Using @StatefulDeployment
import javax.ejb.Stateless;
import oracle.j2ee.ejb.StatelessDeployment;
@Stateless
@StatefulDeployment(
idletime=100,
memoryThroshold=90,
maxInstances=10,
maxInstancesThreshold=80,
passivateCount=3,
resourceCheckInterval=90
)
public class HelloWorldBean implements HelloWorld {
public void sayHello(String name) {
System.out.println("Hello "+name +" from first EJB3.0");
}
}
For an EJB 3.0 stateful session bean, you configure passivation criteria in the orion-ejb-jar.xml file as you would for an EJB 2.1 stateful session bean (see "Using Deployment XML").