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.

prepare() 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.

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

isCriticalError(java.sql.SQLException) 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
 void enableSQLTransactions(boolean flag)
          Enables or disables transaction demarcation through SQL commit and rollback.
 boolean isCriticalError(java.sql.SQLException except)
          Returns true if the error issued by this connection is a critical error and the connection should be terminated.
 boolean prepare()
          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)

prepare

public boolean prepare()
                throws java.sql.SQLException
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:
java.sql.SQLException - If transaction has been marked for rollback or cannot commit for any reason

isCriticalError

public boolean isCriticalError(java.sql.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


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.