tyrex.resource.jdbc.xa

Interface TwoPhaseConnection

public interface TwoPhaseConnection

Defines two-phase commit support for a JDBC connection used by XAConnectionImpl. A JDBC connection that can implement any of these features should extend this interface and attempt to implement as much as it can.

TwoPhaseConnection is used as part of the two phase commit protocol to determine whether the transaction can commit or must rollback. Failure to implement this method will cause all connections to vote for commit, whether or not they can actually commit, leading to mixed heuristics.

TwoPhaseConnection allows the SQL begin/commit/rollback commands to be disabled for the duration of a transaction managed through an javax.transaction.xa.XAResource, preventing the application from demarcating transactions directly.

TwoPhaseConnection is used to tell if an exception thrown by the connection is fatal and the connection should not be returned to the pool.

Version: 1.0

Author: Assaf Arkin

Method Summary
voidenableSQLTransactions(boolean flag)
Enables or disables transaction demarcation through SQL commit and rollback.
booleanisCriticalError(SQLException except)
Returns true if the error issued by this connection is a critical error and the connection should be terminated.
booleanprepare()
Called to prepare the transaction for commit.

Method Detail

enableSQLTransactions

public void enableSQLTransactions(boolean flag)
Enables or disables transaction demarcation through SQL commit and rollback. When the connection falls under control of XAConnectionImpl, SQL commit/rollback commands will be disabled to prevent direct transaction demarcation.

Parameters: flag True to enable SQL transactions (the default)

isCriticalError

public boolean isCriticalError(SQLException except)
Returns true if the error issued by this connection is a critical error and the connection should be terminated.

Parameters: except The exception thrown by this connection

prepare

public boolean prepare()
Called to prepare the transaction for commit. Returns true if the transaction is prepared, false if the transaction is read-only. If the transaction has been marked for rollback, throws a RollbackException.

Returns: True if can commit, false if read-only

Throws: SQLException If transaction has been marked for rollback or cannot commit for any reason

Original code is Copyright (c) 1999-2001, Intalio, Inc. All Rights Reserved. Contributions by MetaBoss team are Copyright (c) 2003-2005, Softaris Pty. Ltd. All Rights Reserved.