Show TOC

Background documentationJTA Transaction Recovery Locate this document in the navigation structure

 

Although transactions possess the ACID characteristics, it is essential that a special mechanism exists to guarantee the consistency of customer data in the event of an unexpected resource crash, Transaction Manager crash, and application server crash.

To guarantee transaction consistency, Application Server Java supports automatic transaction recovery provided by the Transaction Service.

JTA transaction recovery is supported for all JCA, JMS, and JDBC resources that are deployed on AS Java and configured to work with two-phase commit transactions.

Java Message Service (JMS) is used in most of the distributed XA transactions, which are the subject of the transaction recovery. To provide this, the JMS provider has been enabled to support the two-phase commit protocol.

For more information about the JMS two-phase commit (XA transaction) support, see Using JMS XA Transactions.

Using XA Transactions

To benefit from the transaction recovery, applications must start distributed JTA transactions using the TransactionManager or the UserTransaction interfaces provided by the AS Java, and must use JCA, JMS, and JDBC resources, configured to support two-phase commit. As Java takes care about enlisting all used resources used in the transaction, and about transaction recovery in the event of a resource manager, Transaction Manager or AS Java crash.

For more information about transaction states, see Distributed Transactions

Commit Processing

The Transaction Manager takes care to commit or rollback the involved JMS, JCA, and JDBC resources altogether. To perform this, the Transaction Manager maintains a transaction log, and uses two-phase commit protocol to call XAResource.prepare(), and then XAResource.commit() on all involved resources.

Recovery

The automatic recovery process is started in two cases:

  • After each server start

    The Transaction Manager checks for old transaction logs from previous runs, and recovers all pending transactions which have not been completed during the previous Transaction Manager run.

  • After a server node crash

    One Transaction Manager on one of the available server nodes gets the transaction log of the crashed Transaction Manager, and completes all pending transactions that have not been completed.

During recovery, the Transaction Manager acquires an old transaction log that is stored either on the file system, or on a database. Then, the Transaction Manager checks if the log contains incomplete transactions, connects to the involved JCA, JMS, and JDBC resources, and completes the transactions. Old transaction logs are removed when the all transactions are completed.

For more information about configuring the transaction recovery, see Configuring the Transaction Service.