web server - Borland Technical Publications
web server - Borland Technical Publications web server - Borland Technical Publications
Transaction manager services Transaction Manager for two-phase commit, you must set the “Allow unrecoverable completion” property to true in “Properties” for the Transaction Manager as displayed under the Partition in the BES Management Console. Alternatively, you can set system property EJBAllowUnrecoverableCompletion for the partition. The OTS engine exists in a separate address space. It provides a complete solution for distributed transactional CORBA applications. Implemented on top of the VisiBroker ORB, the OTS engine simplifies the complexity of distributed transactions by providing an essential set of services - including a transaction service, recovery and logging, integration with databases, and administration facilities - within one, integrated architecture. Distributed transactions and two-phase commit Note The Borland EJB Container supports distributed transactions. Distributed transactions are those transactions that cross systems, platforms, and Java Virtual Machines (JVMs). Transactions that manipulate data across multiple resources use a two-phase commit process. This process ensures that the transaction correctly updates all resources involved in the transaction. If it cannot update all resources, then it updates none of the resources. Although support is provided by BES for two-phase commit transactions, they are inherently expensive due to number of remote procedure calls (RPCs) and should be used only when needed. See “When to use two-phase commit transactions” on page 170. There are two steps to a two-phase commit. The first step is the preparation phase. In this phase the transaction service requests that each resource involved in the transaction readies its updates and signal to the transaction service whether it can commit the updates. The second step is the commit phase. The transaction service initiates the actual resource updates only when all resources have signaled that they can complete the update process. Should any resource signal they cannot perform updates, the transaction service instructs all other resources to rollback all updates involved in the transaction. The Transaction Manager and OTS engine support both heterogeneous distributed (two-phase commit) transactions and two-phase commit for homogeneous resources. By default, the Transaction Manager does not allow multiple resources to participate in a global transaction, but it can be configured to allow multiple resource participation through its support for unrecoverable transaction completion. This can be enabled on the Transaction Manager by setting either “Allow unrecoverable completion” option from the Management Console (right-click the Transaction Manager and select “Properties”), or the Partition system property EJBAllowUnrecoverableCompletion. When unrecoverable transaction completion is enabled, the container makes a one-phase commit call on each participating resource during the transaction commit process. Care must taken when enabling unrecoverable transaction completion; as the name suggests, no recovery is available when a failure occurs prior to transaction completion, which may lead to inconsistent states in participating resources. To support heterogeneous two-phase commit transactions, the OTS engine must integrate with XA support in the underlying resources. With availability of XA-enabled JDBC drivers from DBMS vendors and JMS support provided by message service providers, the EJB container and OTS engine allow multiple resources to participate in a single transaction. Two-phase commit for homogeneous databases requires some configuration of the DBMS servers. While the container controls the commit to the first database, the DBMS server controls the commits to the subsequent databases using the DBMS's built-in transaction coordinator. For more information, see your vendor's manual for the DBMS server. Chapter 19: Transaction management 169
Transaction manager services When to use two-phase commit transactions One of the basic principals of building high performance distributed applications is to limit the number of remote procedure calls (RPCs). The following explains typical situations; when and when not to use two-phase commit transactions. Avoiding a twophase commit transaction when it is not needed, therefore avoiding unnecessary RPCs involving JTA XAResource objects and the OTS engine, greatly improves your application's performance. Using multiple JDBC connections for access to multiple database resources from a single vendor in the same transaction In scenarios involving multiple databases from a single vendor, it is often possible to avoid using two-phase commit. You can access one database and use it to access the second database by tunneling access through the connection to the first database. Oracle and other DBMSs provide this capability. In this case the BES Partition can be configured with only one JDBC connection to the “fronting” database. Access to the “backing” database is tunneled through the first JDBC connection. Using multiple JDBC connections to the same database resource in the same transaction When multiple JDBC connections to the same database are obtained and used by distributed participants within a single transaction, a two-phase commit can be avoided. The JDBC connections, as expected, need to be obtained from a XA datasource. But, rather than performing a two-phase commit, a one-phase commit can be used to complete the transaction since only a single resource is involved. This is achieved by using the Transaction Manager rather than the OTS engine. An alternative is to collocate all EJBs involved in the transaction, rather than having them deployed in distributed Partitions. In this case, a non-XA datasource is used and no two-phase commit is required. Note Using multiple disparate resources in a single transaction In this case there is a need for a two-phase commit transaction. This situation arises when, for example, you are running a single transaction against both Oracle and Sybase, or if you have a transaction that includes access to an Oracle database and a JMS provider, such as MQSeries. In the latter case, the transaction is coordinated using JTA XAResource object, obtained from Oracle via JDBC and MQSeries via JMS, and enables both resources to participate in the two-phase commit transaction completion. It is worth noting that two-phase commit capabilities (provided by the OTS engine), are only needed when a single transaction involves access to multiple incompatible resources. In order to utilize the OTS engine as the default transaction service, the Transaction Manager must be stopped first. 170 BES Developer’s Guide
- Page 129 and 130: Container-Managed Persistence in Bo
- Page 131 and 132: Setting Properties Setting Properti
- Page 133 and 134: Setting Properties into a BLOB. The
- Page 135 and 136: Setting Properties Automatic table
- Page 137 and 138: 126 BES Developer’s Guide
- Page 139 and 140: Container-managed persistence and R
- Page 141 and 142: Container-Managed Persistence in Bo
- Page 143 and 144: Container-Managed Persistence in Bo
- Page 145 and 146: Container-Managed Persistence in Bo
- Page 147 and 148: Container-Managed Persistence in Bo
- Page 149 and 150: Container-Managed Persistence in Bo
- Page 151 and 152: Container-Managed Persistence in Bo
- Page 153 and 154: 142 BES Developer’s Guide
- Page 155 and 156: Setting Properties J2EE 1.3 Entity
- Page 157 and 158: Setting Properties Figure 16.2 Edit
- Page 159 and 160: Setting Properties Table 16.1 ejb.m
- Page 161 and 162: Setting Properties Table 16.3 Table
- Page 163 and 164: Setting Properties Security Propert
- Page 165 and 166: Aggregate Functions in EJB-QL Selec
- Page 167 and 168: Support for ORDER BY Support for OR
- Page 169 and 170: Overriding SQL generated from EJB-Q
- Page 171 and 172: Container-managed data access suppo
- Page 173 and 174: 162 BES Developer’s Guide
- Page 175 and 176: Generating primary keys from a cust
- Page 177 and 178: Implementing primary key generation
- Page 179: Transaction manager services Consis
- Page 183 and 184: Transaction manager services Follow
- Page 185 and 186: Declarative transaction management
- Page 187 and 188: Declarative transaction management
- Page 189 and 190: JDBC API Modifications JDBC API Mod
- Page 191 and 192: Handling of EJB exceptions Applicat
- Page 193 and 194: 182 BES Developer’s Guide
- Page 195 and 196: Client View of an MDB Client View o
- Page 197 and 198: Clustering of MDBs This is yet anot
- Page 199 and 200: Error Recovery Redelivered messages
- Page 201 and 202: 190 BES Developer’s Guide
- Page 203 and 204: JNDI Definitions Module Important s
- Page 205 and 206: Disabling and Enabling a Deployed D
- Page 207 and 208: Configuring JDBC Datasources In the
- Page 209 and 210: Configuring JDBC Datasources To add
- Page 211 and 212: Defining the Connection Pool Proper
- Page 213 and 214: Defining the Connection Pool Proper
- Page 215 and 216: Descriptions of Borland Enterprise
- Page 217 and 218: Advanced Topics for Defining JDBC D
- Page 219 and 220: Connecting to JDBC Resources from J
- Page 221 and 222: Configuring JMS Connection Factorie
- Page 223 and 224: Defining Connection Pool Properties
- Page 225 and 226: Obtaining JMS Connection Factories
- Page 227 and 228: JMS and Transactions and its accomp
- Page 229 and 230: JMS and Transactions For instance:
Transaction manager services<br />
When to use two-phase commit transactions<br />
One of the basic principals of building high performance distributed applications is to<br />
limit the number of remote procedure calls (RPCs). The following explains typical<br />
situations; when and when not to use two-phase commit transactions. Avoiding a twophase<br />
commit transaction when it is not needed, therefore avoiding unnecessary RPCs<br />
involving JTA XAResource objects and the OTS engine, greatly improves your<br />
application's performance.<br />
Using multiple JDBC connections for access to multiple database<br />
resources from a single vendor in the same transaction<br />
In scenarios involving multiple databases from a single vendor, it is often possible to<br />
avoid using two-phase commit. You can access one database and use it to access the<br />
second database by tunneling access through the connection to the first database.<br />
Oracle and other DBMSs provide this capability. In this case the BES Partition can be<br />
configured with only one JDBC connection to the “fronting” database. Access to the<br />
“backing” database is tunneled through the first JDBC connection.<br />
Using multiple JDBC connections to the same database resource in the<br />
same transaction<br />
When multiple JDBC connections to the same database are obtained and used by<br />
distributed participants within a single transaction, a two-phase commit can be<br />
avoided. The JDBC connections, as expected, need to be obtained from a XA<br />
datasource. But, rather than performing a two-phase commit, a one-phase commit can<br />
be used to complete the transaction since only a single resource is involved. This is<br />
achieved by using the Transaction Manager rather than the OTS engine. An alternative<br />
is to collocate all EJBs involved in the transaction, rather than having them deployed in<br />
distributed Partitions. In this case, a non-XA datasource is used and no two-phase<br />
commit is required.<br />
Note<br />
Using multiple disparate resources in a single transaction<br />
In this case there is a need for a two-phase commit transaction. This situation arises<br />
when, for example, you are running a single transaction against both Oracle and<br />
Sybase, or if you have a transaction that includes access to an Oracle database and a<br />
JMS provider, such as MQSeries. In the latter case, the transaction is coordinated<br />
using JTA XAResource object, obtained from Oracle via JDBC and MQSeries via JMS,<br />
and enables both resources to participate in the two-phase commit transaction<br />
completion. It is worth noting that two-phase commit capabilities (provided by the OTS<br />
engine), are only needed when a single transaction involves access to multiple<br />
incompatible resources.<br />
In order to utilize the OTS engine as the default transaction service, the Transaction<br />
Manager must be stopped first.<br />
170 BES Developer’s Guide