|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tyrex.resource.jdbc.xa.XAConnectionImpl
Implements an X/A connection that can be pooled and managed from
inside a transaction monitor. This is the XA connection returned
to the application server from the XADataSourceImpl
and
will be used to obtain ClientConnection
for the
application.
If the transaction is managed through the JDBC interface, this
connection will reference the underlying JDBC connection directly.
If this resource is enlisted with a global transaction through
the XAResource
interface, it will reference a transactional
connection, or TxConnection
. Such a connection may be
shared by two or more XA connections enlisted with the same
transaction.
ClientConnection
,
ConnectionEventListener
,
TxConnection
Field Summary | |
(package private) java.sql.Connection |
_underlying
This is the underlying JDBC connection represented by this pooled connection. |
Fields inherited from interface javax.transaction.xa.XAResource |
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY |
Constructor Summary | |
(package private) |
XAConnectionImpl(XADataSourceImpl resManager,
java.sql.Connection underlying,
java.lang.String userName,
java.lang.String password)
Construct a new XA/pooled connection with the underlying JDBC connection suitable for this driver only. |
Method Summary | |
void |
addConnectionEventListener(javax.sql.ConnectionEventListener listener)
|
void |
close()
|
void |
commit(javax.transaction.xa.Xid xid,
boolean onePhase)
|
void |
end(javax.transaction.xa.Xid xid,
int flags)
|
protected void |
finalize()
|
void |
forget(javax.transaction.xa.Xid xid)
|
java.sql.Connection |
getConnection()
|
int |
getTransactionTimeout()
|
(package private) java.sql.Connection |
getUnderlying(int clientId)
Called to obtain the underlying connections. |
javax.transaction.xa.XAResource |
getXAResource()
|
(package private) boolean |
insideGlobalTx()
Returns true if this connection is inside a global transaction. |
boolean |
isSameRM(javax.transaction.xa.XAResource xaRes)
|
(package private) void |
notifyClose(int clientId)
Called by ClientConnection to notify that the application
has attempted to close the connection. |
(package private) void |
notifyError(int clientId,
java.sql.SQLException except)
Called by ClientConnection to notify that an error
occured with the underlying connection. |
int |
prepare(javax.transaction.xa.Xid xid)
|
javax.transaction.xa.Xid[] |
recover(int flags)
|
void |
removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
|
void |
rollback(javax.transaction.xa.Xid xid)
|
boolean |
setTransactionTimeout(int seconds)
|
void |
start(javax.transaction.xa.Xid xid,
int flags)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
java.sql.Connection _underlying
getUnderlying(int)
will return a new
connection and set this variable. This variable is mutually
exclusive with #_txConn
and is always null for
connections inside a transaction.
Constructor Detail |
XAConnectionImpl(XADataSourceImpl resManager, java.sql.Connection underlying, java.lang.String userName, java.lang.String password) throws java.sql.SQLException
resManager
- the resource manager for the underlying
connectionsunderlying
- the underlying connection. Can be null.userName
- the user name for the underlying connection.
Can be null.password
- the password for the underlying connection.
Can be null.Method Detail |
public void close() throws java.sql.SQLException
close
in interface javax.sql.PooledConnection
java.sql.SQLException
public javax.transaction.xa.XAResource getXAResource()
getXAResource
in interface javax.sql.XAConnection
public void addConnectionEventListener(javax.sql.ConnectionEventListener listener)
addConnectionEventListener
in interface javax.sql.PooledConnection
public void removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
removeConnectionEventListener
in interface javax.sql.PooledConnection
public java.sql.Connection getConnection() throws java.sql.SQLException
getConnection
in interface javax.sql.PooledConnection
java.sql.SQLException
void notifyClose(int clientId)
ClientConnection
to notify that the application
has attempted to close the connection. After this call, the client
connection is no longer useable and this pooled connection can be
reused. The event listener is notified immediately.
clientId
- The ClientConnection
identifiervoid notifyError(int clientId, java.sql.SQLException except)
ClientConnection
to notify that an error
occured with the underlying connection. If the error is
critical, the underlying connection is closed and the listener
is notified.
clientId
- The ClientConnection
identifierexcept
- The exception raised by the underlying connectionprotected void finalize() throws java.lang.Throwable
java.lang.Throwable
public java.lang.String toString()
public void start(javax.transaction.xa.Xid xid, int flags) throws javax.transaction.xa.XAException
start
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
public void end(javax.transaction.xa.Xid xid, int flags) throws javax.transaction.xa.XAException
end
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
public void forget(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
forget
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
public int prepare(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
prepare
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
public javax.transaction.xa.Xid[] recover(int flags) throws javax.transaction.xa.XAException
recover
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
public void commit(javax.transaction.xa.Xid xid, boolean onePhase) throws javax.transaction.xa.XAException
commit
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
public void rollback(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
rollback
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
public boolean isSameRM(javax.transaction.xa.XAResource xaRes) throws javax.transaction.xa.XAException
isSameRM
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
public boolean setTransactionTimeout(int seconds) throws javax.transaction.xa.XAException
setTransactionTimeout
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
public int getTransactionTimeout()
getTransactionTimeout
in interface javax.transaction.xa.XAResource
boolean insideGlobalTx()
Connection
interface.
java.sql.Connection getUnderlying(int clientId) throws java.sql.SQLException
clientId
- The ClientConnection
identifier
java.sql.SQLException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |