Skip Headers
Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide
10g (10.1.3.5.0)

Part Number E13981-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

Configuring EJB 3.0 and EJB 2.1 Stateful Session Bean Replication Policy

The general procedure for configuring EJB application clustering for an EJB 3.0 or EJB 2.1 stateful session bean is as follows:

  1. Configure your OC4J application cluster (see "Application Clustering in OC4J" in the Oracle Containers for J2EE Configuration and Administration Guide).

  2. Configure a replication policy for stateful session beans on each node (see "Using Deployment XML").

  3. Configure load-balancing behavior (see "Configuring Load Balancing Behavior").

  4. Deploy your enterprise bean to any one of the nodes in the cluster.

For more information, see the following:

Using Deployment XML

To configure a replication policy, add a <replication-policy> element to one or more of the appropriate deployment descriptor files that Table 24-1 lists. You can specify a single replication policy that OC4J applies globally, or specify finer-grained replication policy at the application level for both Web and EJB components, or EJB components only.

Configure the trigger attribute to one of the following:

  • inherited – The stateful session bean uses the state replication trigger setting you configure at the application level. This is the default value.

  • onRequestEnd – The state of the stateful session bean is replicated to all hosts in the cluster (with the same multicast address, port) at the end of each EJB method call. If the node loses power, then the state has already been replicated. This method offers less performance than the JVM termination replication mode, because the state is sent out more often. However, the guarantee for reliance is higher.

  • onShutdown –The state of the stateful session bean is replicated to only one other host in the cluster (with the same multicast address, port) when the JVM is terminating. This option provides the highest performance, because the state is replicated only once. However, it is not very reliable for the following reasons:

    • Your state is not replicated if the host is terminated unexpectedly.

    • The state of the bean exists only on a single host at any time; you carry a higher risk that the state does not replicate and is lost.

  • none–Disable clustering for this stateful session bean.

Note:

Using Application Server Control, you cannot configure the trigger attribute to inherited or none. To set these values, edit the deployment XML manually. For more information, see "Using Oracle Enterprise Manager 10g Application Server Control"

The scope attribute is always set to allAttributes for a stateful session bean.

For more information, see "State Replication".

Table 24-1 Deployment XML Files for Replication Policy Configuration

Scope Components Deployment XML File See also ...

Global

Web and EJB

application.xml

"Stateful Session EJB State Replication with Oracle Application Server Cluster (OC4J)" in the Oracle Application Server High Availability Guide

Application-level

Web and EJB

orion-application.xml

"Stateful Session EJB State Replication with Oracle Application Server Cluster (OC4J)" in the Oracle Application Server High Availability Guide

Application-level

EJB

orion-ejb-jar.xml

"Overriding Application-Level Replication Policy in the orion-ejb-jar.xml File for EJB Components"


Overriding Application-Level Replication Policy in the orion-ejb-jar.xml File for EJB Components

When you configure the orion-ejb-jar.xml file with a state replication policy for a stateful session bean (see Example 24-1), each bean can use a different type of replication independent of the Web component replication type.

Example 24-1 The orion-ejb-jar.xml For an Application-Level Replication Policy for EJB

<orion-ejb-jar>
...
    <session-deployment
        name="AirlinePOEndpointBean"
        max-tx-retries="0"
        location="AirlinePOEndpointBean"
        persistence-filename="AirlinePOEndpointBean">
...
        <replication-policy
            trigger="onRequestEnd"            scope="allAttributes"
        />
...
    </session-deployment>
...
</orion-ejb-jar>