tyrex.resource.jdbc.xa
Class ClientConnection
java.lang.Object
|
+--tyrex.resource.jdbc.xa.TyrexConnection
|
+--tyrex.resource.jdbc.xa.ClientConnection
- All Implemented Interfaces:
- java.sql.Connection
- final class ClientConnection
- extends TyrexConnection
- implements java.sql.Connection
Encapsulates an application's view of an XA/pooled connection.
The XA connection is managed by the application server through it's
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
Fields inherited from interface java.sql.Connection |
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE |
Constructor Summary |
(package private) |
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 |
void |
commit()
|
boolean |
getAutoCommit()
|
protected void |
internalClose()
Method that actually closes the connection. |
protected java.sql.Connection |
internalGetUnderlyingConnection()
Called to retrieve the underlying JDBC connection. |
boolean |
isClosed()
Return true if the connection is closed. |
protected void |
notifyError(java.sql.SQLException except)
Called when an exception is thrown by the underlying connection
to determine whether the exception is critical or not. |
void |
rollback()
|
void |
setAutoCommit(boolean autoCommit)
|
java.lang.String |
toString()
Called by XAConnectionImpl to terminate this connection
by dissociating it from the underlying JDBC connection. |
Methods inherited from class tyrex.resource.jdbc.xa.TyrexConnection |
clearWarnings, close, createStatement, createStatement, finalize, getCatalog, getMetaData, getTransactionIsolation, getTypeMap, getWarnings, isReadOnly, nativeSQL, prepareCall, prepareCall, prepareStatement, prepareStatement, setCatalog, setReadOnly, setTransactionIsolation, setTypeMap |
Methods inherited from class java.lang.Object |
, clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.sql.Connection |
clearWarnings, close, createStatement, createStatement, getCatalog, getMetaData, getTransactionIsolation, getTypeMap, getWarnings, isReadOnly, nativeSQL, prepareCall, prepareCall, prepareStatement, prepareStatement, setCatalog, setReadOnly, setTransactionIsolation, setTypeMap |
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 connectionxaDataSource
- the data source that created the xaConnclientId
- A unique identifier handed to us by
XAConnection
underlying
- The underlying JDBC connection
setAutoCommit
public void setAutoCommit(boolean autoCommit)
throws java.sql.SQLException
- Specified by:
setAutoCommit
in interface java.sql.Connection
- Overrides:
setAutoCommit
in class TyrexConnection
getAutoCommit
public boolean getAutoCommit()
throws java.sql.SQLException
- Specified by:
getAutoCommit
in interface java.sql.Connection
- Overrides:
getAutoCommit
in class TyrexConnection
commit
public void commit()
throws java.sql.SQLException
- Specified by:
commit
in interface java.sql.Connection
- Overrides:
commit
in class TyrexConnection
rollback
public void rollback()
throws java.sql.SQLException
- Specified by:
rollback
in interface java.sql.Connection
- Overrides:
rollback
in class TyrexConnection
internalClose
protected void internalClose()
throws java.sql.SQLException
- Description copied from class:
TyrexConnection
- Method that actually closes the connection.
- Overrides:
internalClose
in class TyrexConnection
- Following copied from class:
tyrex.resource.jdbc.xa.TyrexConnection
- Throws:
java.sql.SQLException
- if there is a problem closing the connection- See Also:
TyrexConnection.close()
isClosed
public boolean isClosed()
- Description copied from class:
TyrexConnection
- Return true if the connection is closed.
- Specified by:
isClosed
in interface java.sql.Connection
- Overrides:
isClosed
in class TyrexConnection
- Following copied from class:
tyrex.resource.jdbc.xa.TyrexConnection
- Returns:
- true if the connection is closed.
toString
public java.lang.String toString()
- Called by
XAConnectionImpl
to terminate this connection
by dissociating it from the underlying JDBC connection.
The application would call TyrexConnection.close()
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.
- Overrides:
toString
in class java.lang.Object
notifyError
protected void notifyError(java.sql.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.
- Overrides:
notifyError
in class TyrexConnection
- Parameters:
except
- The exception thrown by the underlying
connection
internalGetUnderlyingConnection
protected java.sql.Connection internalGetUnderlyingConnection()
throws java.sql.SQLException
- Called to retrieve the underlying JDBC connection. Actual JDBC
operations are performed against it. Throws an SQLException if
this connection has been closed.
- Overrides:
internalGetUnderlyingConnection
in class TyrexConnection
- Following copied from class:
tyrex.resource.jdbc.xa.TyrexConnection
- Returns:
- the underlying connection
- Throws:
java.sql.SQLException
- if the connection cannot be retrieved.- See Also:
#getUnderlyingConnection
Intalio Inc. (C) 1999-2001. All rights reserved.