tyrex.resource.jdbc.xa

Class ClientConnection

final class ClientConnection extends TyrexConnection implements Connection

Encapsulates an application's view of an XA/pooled connection. The XA connection is managed by the application server through it's javax.sql.XAConnection interface. The underlying JDBC connection is a standard JDBC connection. The application's JDBC connection gives access to the underlying JDBC connection but is managed by the application server. The application is given an instance of this class and not the underlying connection directly.

Version: 1.0

Author: Assaf Arkin

See Also: XAConnectionImpl XADataSourceImpl Connection

Constructor Summary
ClientConnection(XAConnectionImpl xaConn, XADataSourceImpl xaDataSource, int clientId)
Construct a new client connection to provide access to the underlying JDBC connection (underlying) on behalf of an XA/pooled connection (xaConn).
Method Summary
voidcommit()
booleangetAutoCommit()
protected voidinternalClose()
protected ConnectioninternalGetUnderlyingConnection()
Called to retrieve the underlying JDBC connection.
booleanisClosed()
protected voidnotifyError(SQLException except)
Called when an exception is thrown by the underlying connection to determine whether the exception is critical or not.
voidrollback()
voidsetAutoCommit(boolean autoCommit)
StringtoString()
Called by XAConnectionImpl to terminate this connection by dissociating it from the underlying JDBC connection.

Constructor Detail

ClientConnection

ClientConnection(XAConnectionImpl xaConn, XADataSourceImpl xaDataSource, int clientId)
Construct a new client connection to provide access to the underlying JDBC connection (underlying) on behalf of an XA/pooled connection (xaConn). The pooled connection is required to notify of connection closure and fatal errors.

Parameters: xaConn The XA/pooled connection that created this client connection xaDataSource the data source that created the xaConn clientId A unique identifier handed to us by XAConnection underlying The underlying JDBC connection

Method Detail

commit

public void commit()

getAutoCommit

public boolean getAutoCommit()

internalClose

protected void internalClose()

internalGetUnderlyingConnection

protected Connection internalGetUnderlyingConnection()
Called to retrieve the underlying JDBC connection. Actual JDBC operations are performed against it. Throws an SQLException if this connection has been closed.

isClosed

public boolean isClosed()

notifyError

protected void notifyError(SQLException except)
Called when an exception is thrown by the underlying connection to determine whether the exception is critical or not. If the exception is critical, notifies the XA connection to forget about this connection.

Parameters: except The exception thrown by the underlying connection

rollback

public void rollback()

setAutoCommit

public void setAutoCommit(boolean autoCommit)

toString

public String toString()
Called by XAConnectionImpl to terminate this connection by dissociating it from the underlying JDBC connection. The application would call ClientConnection but XAConnectionImpl cannot, since pooled connection requirements will cause an inifinite loop. This method should not attempt to notify either a closure or fatal error, but rather throw an exception if it fails.
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.