Up to this point, the discussion of transactions has focused on the local case—
transactions involving a single data source. This chapter introduces the distributed
case where a single transaction involves multiple connections to one or more
underlying data sources.
The following discussion includes these topics:
- distributed transaction infrastructure
- transaction managers and resource managers
- the XADataSource, XAConnection, and XAResource interfaces
- two-phase commit
APITM (JTATM) . The examples presented here are high-level; the JTA specification
should be consulted for a more substantial discussion.
Infrastructure
Distributed transactions require an infrastructure that provides these roles:
- Transaction manager — controls transaction boundaries and manages the twophase commit protocol. This typically will be an implementation of JTA.
- JDBC drivers that implement the XADataSource, XAConnection, and XAResource interfaces. These are described in the next section.
- An application-visible implementation of DataSource to “sit on top of” each XADataSource object and interact with the transaction manager. The DataSource implementation is typically provided by an application server. Because the XADataSource interface extends the ConnectionPoolDataSource interface, the DataSource implementation will usually include a connection pooling module as well.
- Resource manager(s) to manage the underlying data. In the context of the JDBC
1. A client tier
2. A middle tier that includes applications, an EJB server working with an external transaction manager, and a set of JDBC drivers
3. Multiple resource managers
Distributed transactions can also be implemented in two tiers. In a two-tier
architecture, the application itself acts as the transaction manager and interacts
directly with the JDBC drivers’ XADataSource implementations.
The following diagram illustrates the distributed transaction infrastructure:
1 comment:
Short and simple, but very informative article on transaction. Keep it up!
Software Tester CV
Post a Comment