JTA Support

The Novell exteNd Messaging Platform's JTS provides an implementation of the JTA UserTransaction and TransactionManager interfaces. These interfaces allow you to start and associate a transaction to the current execution thread, allow resources from differen DBMS servers to participate in a transaction, and complete the transaction with rollback or with two phase commit protocol across multiple DBMS servers.  The TM allows the following types of resources to be enlisted in transactions via the JTA interfaces:

Using XAResource

Using OnePhaseResource

Using XAResource

XA capable resource managers provide XADataSource objects to provide connections that can participate in distributed transactions. The XADataSource is a factory of XAConnections, which has a Connection and a XAResource objects. The Connection object provides access to data and is used in the application code. The XAResource provides means of associating the work done by the Connection with one or more transaction branches, and ability to commit or rollback each of the work belonging to a tranasction branch indipendently.

In a distributed transction multiple XAConnection participate in a transction, and the tranasction manager coordinates the completion of the transaction so that its final outcome is automic. That is all work in all XAConnections are commited, or all work in all XAConnections are rolledback.

Using OnePhaseResource

The OnePhaseResource interface is a proprietary interface of the transaction manager which allows for a non-XA capable JDBC connection to participate in a distributed transaction with other XAResources. The transaction manager allows only one such resource to participate in a transaction, and during the two phase commit process, the TM commits the OnePhaseResource after preparing all other XAResources and before starting the commit phase.

The OnePhaseResource is thet last resource to be called during the prepare phase, and it is called to commit only after all others have voted to commit the transaction. The successful commit of the OnePhaseResource is treated as vote to commit the transaction, other wise it is considred a vote to rollback. The commit phase of the transaction completion proceeeds with the TM calling all other resources to commit or rollback based on the outcome of the prepare phase.

In order for the OnePhaseResouse to participate in a distributed transaction, the following rules must be followed:

  1. The local transaction control methods commit, rollback, and setAutocommit can not be called on the underlying java.sql.Connection.
  2. The auto commit mode must be turned of on the underlying java.sql.Connection, so that the database connection is using local transactions.
  3. The java.sql.Connection can not be shared in any other transaction.

The transaction manager will call the OnePhaseResource object with appropriate calls to commit its transaction with one phase commit protocol. That is the OnePhaseResource will not be called to prepare.


Copyright © 1998-2003, Novell, Inc. All rights reserved.