|
Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide
10g Release 3 (10.1.3) B14428-01 |
|
![]() Previous |
![]() Next |
To improve application performance, you can configure a transaction timeout that determines how long OC4J will wait for a transaction to commit or rollback.
This section describes:
You can set a transaction timeout that applies globally to all transactions that OC4J manages for session and entity beans.
You can configure the global transaction timeout:
Using the Application Server Control Console (see "Using Oracle Enterprise Manager 10g Application Server Control"), you can set the JTAResource MBean attribute transactionTimeout.
For more information, see "How to configure the OC4J Transaction Manager" in the Oracle Containers for J2EE Services Guide.
In the <OC4J_HOME>\j2ee\home\config\transaction-manager.xml file you set the global transaction timeout with the transaction-timeout attribute of the <transaction-manager> element.
For example, if you wanted to set the global transaction timeout to 180 seconds, you would do as follows:
<transaction-manager ... transaction-timeout="180" ... </transaction-manager>
If you change this property using this method, you must restart OC4J to apply your changes. Alternatively, you can use Application Server Control Console to modify this parameter dynamically without restarting OC4J (see "Using Application Server Control Console").
You can configure a transaction timeout on a per-session bean basis (see "Using Deployment XML"). The per-session bean transaction timeout overrides the global transaction timeout (see "Configuring a Global Transaction Timeout").
In the orion-ejb-jar.xml file you set a per-session bean transaction timeout with the transaction-timeout attribute of the <session-deployment> element.
For example, if you wanted to set the global transaction timeout to 180 seconds, you would do as follows:
<session-deployment ... transaction-timeout="180" ... </session-deployment>
If you change this property using this method, you must restart OC4J to apply your changes.
You can configure a transaction timeout on a per-message-driven bean basis (see "Using Deployment XML").
Because the global transaction timeout (see "Configuring a Global Transaction Timeout") does not apply to message-driven beans, you must configure transaction timeout on a per-message-driven bean basis if you want to change the default transaction timeout for a message-driven bean.
The type of message service provider you use (see "What Message Providers Can I use with My MDB?") affects your transaction timeout options:
Oracle Application Server JMS (OracleAS JMS): you cannot change the transaction timeout from the default of 86,400 seconds (1 day).
Oracle JMS (OJMS): you can change the transaction timeout (see "Non-J2CA Adapter Message Service Provider").
J2EE Connector Architecture (J2CA) adapter message provider: you can change the transaction timeout (see "J2CA Adapter Message Service Provider").
You set the transaction timeout in the orion-ejb-jar.xml file. How you configure this value depends on the type of message-service provider you are using:
Non-J2CA Adapter Message Service Provider
If you are using a non-J2CA adapter message service provider like OracleAS JMS or Oracle JMS (OJMS), use the transaction-timeout attribute of the <message-driven-deployment> element.
For example, if you are using OracleAS JMS or Oracle JMS (OJMS), and you wanted to set the transaction timeout to 180 seconds, you would do as follows:
<message-driven-deployment ... transaction-timeout="180" ... </message-driven-deployment>
J2CA Adapter Message Service Provider
If you are using a J2CA adapter message service provider, use the <config-property> element to set the transactionTimeout configuration property.
For example, if you are using a J2CA adapter message service provider, and you wanted to set the transaction timeout to 180 seconds, you would do as follows:
<message-driven-deployment ... > ... <config-property> <config-property-name>transactionTimeout</config-property-name> <config-property-value>180</config-property-value> </config-property> ... </message-driven-deployment>
In either case, if you change this property using this method, you must restart OC4J to apply your changes.