|
Helping ordinary people create extraordinary websites! |
Understanding JCA TransactionsBy Mikhail Genkin2005-04-22
JCA Transaction Support The two resource adapters shown in Listings 1 and 2 differ in their levels of transactional support. In my e-commerce application, however, I need to coordinate a transaction across these two different systems. To help manage this, the JCA transaction contract defines a set of architected interfaces through which the application server and the EIS coordinate the transaction. The EJB container talks to the EIS via the resource adapter's implementation of the ManagedConnection interface, which represents the physical connection to that EIS. The ManagedConnection implementation typically uses a proprietary library to talk to the EIS using a protocol it understands. If the resource adapter supports local transactions, it also implements the javax.resource.spi.LocalTransaction interface. When the EJB container needs to initiate the transaction it will call the getLocalConnection() method on the ManagedConnection implementation instance. Subsequently it will call the LocalTransactions begin(), commit(), and rollback() methods to control the transaction. If the resource adapter supports XA or global transactions it also implements the javax.transaction.xa.XAResource interface. Every J2EE-compliant application server has an internal component called the Transaction Manager. The Transaction Manager is actually an implementation of the javax.transaction.TransactionManager interface. This component helps the application server manage transaction boundaries. The Transaction Manager uses the getXAResource() method defined by the ManagedConnection interface to retrieve an instance of XAResource. The Transaction Manager uses methods defined on the XAResource interface to coordinate the 2PC protocol across multiple resource managers. Tutorial Pages: » Learn How the Various Levels of Transaction Support Provided by Different EISs and Resource Adapters Can Affect Application Design. » Overview of JCA Transactions » Transaction Support Levels » JCA Transaction Support » Transaction Demarcation Strategies » Programmatic Transaction Demarcation » EJB Deployment Descriptor Settings » In Conclusion » Resources First published by IBM DeveloperWorks |
|