| Sign In/My Account | View Cart |
J2EE Transaction Frameworks: Building the Framework
Pages: 1, 2, 3, 4
Each transaction should preserve the ACID properties for the system to reflect the correct (i.e., consistent) state of reality. Unlike a centralized computing environment where application components and resources are located at a single site, and transaction management only involves a local data manager running on a single machine, in a distributed computing environment all the resources are distributed across multiple systems. In such a case transaction management needs to be done both at local and global levels. A local transaction is one which involves activities in a single local resource manager. A distributed or a global transaction is executed across multiple systems, and its execution requires coordination between the global transaction management system and all the local data managers of all the involved systems. The Resource Manager and Transaction Manager (TM), also known as a transaction processing monitor (TP monitor), are the two primary elements of any transactional system. In centralized systems, both the TP monitor and the resource manager are integrated into the DBMS server. To support advanced functionalities required in a distributed component-based system, separation of TP monitor from the resource managers is required.
Transaction management taxonomy
The most common configurations of transactional enterprise systems are the following.
There are two ways to specify transactions, namely, (i) programmatic and (ii) declarative.
Transaction propagation
A global or distributed transaction consists of several subtransactions and is treated as a single recoverable atomic unit. The global transaction manager is responsible for managing distributed transactions by coordinating with different resource managers to access data at several different systems. Since multiple application components and resources participate in a transaction, it's necessary for the transaction manager to establish and maintain the state of the transaction as it occurs. This is achieved by using a transaction context, which is an association between the transactional operations on the resources and the components invoking the operations. During the course of a transaction, all the threads participating in the transaction share the same transaction context. The scope of a transaction context logically encapsulates all the operations performed on transactional resources during a transaction. The transaction manager needs to analyze the transaction request and decompose the transaction into many subtransactions, propagate the transaction context, and send them to associated resource managers. The transaction context is usually maintained transparently by the underlying transaction manager.
|
Resource managers inform the transaction manager of their participation in a transaction by means of a process called resource enlistment. The transaction manager keeps track of all the resources participating in a transaction by resource enlistment and uses this information to coordinate transactional work performed by the resource managers with two-phase commit and recovery protocol. All the resources enlisted are deleted at the end of a transaction, i.e., after it either commits or rolls back. The transaction manager has to monitor the execution of the transaction and determine whether to commit or roll back the changes made by the transaction to ensure the atomicity of the transaction.