img
As shown in Figure 13-1, four main parties participate in a global transaction (also generally referred
to as distributed transactions). The first party is the backend resource, such as an RDBMS, messaging
middleware, an enterprise resource planning (ERP) system, and so on.
The second party is the resource manager, which was generally provided by the backend resource
vendor and is responsible for interacting with the backend resource. For example, when connecting to a
MySQL database, we will need to interact with the MysqlXADataSource class provided by MySQL's Java
connector. Other backend resources (e.g., MQ, ERP, and so on) will provide their resource managers too.
The third party is the JTA transaction manager, which is responsible for managing, coordinating, and
synchronizing the transaction status with all resource managers that are participating in the transaction.
The XA protocol will be used, which is an open standard widely used for distributed transaction processing.
The JTA transaction manager also supports 2PC so that all changes will be committed together, and if any
resource update fails, the entire transaction will be rolled back, resulting in none of the resources being
updated. The entire mechanism was specified by the Java Transaction Service (JTS) specification.
The final component is the application. Either the application itself or the underlying container or
Spring framework that the application runs on will manage the transaction (begin, commit, roll back a
transaction, and so on). At the same time, the application will interact with the underlying backend
resources via various standards defined by JEE. As shown in Figure 13-1, the application connects to the
RDBMS via JDBC, MQ via JMS, and an ERP system via Java Connector Architecture (JCA).
JTA is supported by all full-blown JEE-compliant application servers (e.g., JBoss, WebSphere,
WebLogic, GlassFish, and so on), within which the transaction is available via JNDI lookup. As for stand-
alone applications or web containers (e.g., Tomcat, Jetty, and so on), there also exists open source and
commercial solutions that provide support for JTA/XA in those environments (e.g., Atomikos, JOTM,
Bitronix, and so on).
Implementations of the PlatformTransactionManager
In Spring, the PlatformTransactionManager interface uses the TransactionDefinition and
TransactionStatus interfaces to create and manage transactions. The actual implementation of these
interfaces must have detailed knowledge of the transaction manager. Figure 13-2 shows the
implementations of PlatformTransactionManager in Spring as of version 3.1.
Figure 13-2. PlatformTransactionManager implementations as of Spring 3.1
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home