Participating in Transactions Managed by a Third-Party Transaction Manager 12-3
Figure 12–2 shows the flow of interactions between a foreign transaction manager,
WebLogic Server client-side JTA objects, and the WebLogic Server transaction manager.
Figure 12–2 State Diagram Illustrating Steps to Import a Transaction Using the Client Interposed
Transaction Manager
To access the interposed transaction manager in WebLogic Server using a client-side gateway, you must perform the following steps:
■
Section 12.2.1, Get the Client Interposed Transaction Manager
■
Section 12.2.2, Get the XAResource from the Interposed Transaction Manager
12.2.1 Get the Client Interposed Transaction Manager
In a client-side gateway, the you can get the WebLogic server interposed transaction managers XAResource with the getClientInterposedTransactionManager
method. For example:
import javax.naming.Context; import weblogic.transaction.InterposedTransactionManager;
import weblogic.transaction.TxHelper; Context initialCtx;
String serverName; InterposedTransactionManager itm =
TxHelper.getClientInterposedTransactionManagerinitialCtx, serverName;
The server name parameter is the name of the server that acts as the interposed transaction manager for the foreign transaction. When the foreign transaction manager
performs crash recovery, it must contact the same WebLogic Server server to obtain the list of in-doubt transactions that were previously imported into WebLogic Server.
12-4 Programming JTA for Oracle WebLogic Server
For more information, see weblogic.transaction.TxHelper in the Oracle WebLogic Server API Reference.
12.2.2 Get the XAResource from the Interposed Transaction Manager
After you get the interposed transaction manager, you must get the XAResource object associated with the interposed transaction manager:
import javax.transaction.xa.XAResource; XAResource xar = itm.getXAResource;
12.2.3 Limitations of the Client Interposed Transaction Manager
Note the following limitations when importing transactions using a client-side gateway:
■
You cannot use the TxHelper.getServerInterposedTransactionManager
method in client-side gateways.
■
You can only use one WebLogic Server client interposed transaction manager at a time. Do not use multiple client interposed transaction managers connecting to
different WebLogic Server servers to import transactions at the same time. See Section 12.4, Transaction Processing for Imported Transactions
for more information about this limitation and how transactions are processed with the
WebLogic Server interposed transaction manager.
12.3 Importing Transactions with the Server Interposed Transaction Manager