public class TransactionRegistry
extends java.lang.Object
The TransactionRegistry hides the details of transaction processing from the existing DBCP pooling code, and gives the ManagedConnection a way to enlist connections in a transaction, allowing for the maximal rescue of DBCP.
Constructor and Description |
---|
TransactionRegistry(javax.transaction.TransactionManager transactionManager)
Creates a TransactionRegistry for the specified transaction manager.
|
Modifier and Type | Method and Description |
---|---|
TransactionContext |
getActiveTransactionContext()
Gets the active TransactionContext or null if not Transaction is active.
|
javax.transaction.xa.XAResource |
getXAResource(java.sql.Connection connection)
Gets the XAResource registered for the connection.
|
void |
registerConnection(java.sql.Connection connection,
javax.transaction.xa.XAResource xaResource)
Registers the association between a Connection and a XAResource.
|
void |
unregisterConnection(java.sql.Connection connection)
Unregisters a destroyed connection from
TransactionRegistry . |
public TransactionRegistry(javax.transaction.TransactionManager transactionManager)
transactionManager
- the transaction manager used to enlist connections.public void registerConnection(java.sql.Connection connection, javax.transaction.xa.XAResource xaResource)
connection
- The JDBC connection.xaResource
- The XAResource which managed the connection within a transaction.public javax.transaction.xa.XAResource getXAResource(java.sql.Connection connection) throws java.sql.SQLException
connection
- the connectionjava.sql.SQLException
- Thrown when the connection does not have a registered XAResource.public TransactionContext getActiveTransactionContext() throws java.sql.SQLException
java.sql.SQLException
- Thrown when an error occurs while fetching the transaction.public void unregisterConnection(java.sql.Connection connection)
TransactionRegistry
.connection
- A destroyed connection from TransactionRegistry
.Copyright © 2000-2022 Apache Software Foundation. All Rights Reserved.