public class TransactionRegistry extends 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(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.
|
XAResource |
getXAResource(Connection connection)
Gets the XAResource registered for the connection.
|
void |
registerConnection(Connection connection,
XAResource xaResource)
Registers the association between a Connection and a XAResource.
|
void |
unregisterConnection(Connection connection)
Unregisters a destroyed connection from
TransactionRegistry . |
public TransactionRegistry(TransactionManager transactionManager)
transactionManager
- the transaction manager used to enlist connections.public void registerConnection(Connection connection, XAResource xaResource)
connection
- The JDBC connection.xaResource
- The XAResource which managed the connection within a transaction.public XAResource getXAResource(Connection connection) throws SQLException
connection
- the connectionSQLException
- Thrown when the connection does not have a registered XAResource.public TransactionContext getActiveTransactionContext() throws SQLException
SQLException
- Thrown when an error occurs while fetching the transaction.public void unregisterConnection(Connection connection)
TransactionRegistry
.connection
- A destroyed connection from TransactionRegistry
.Copyright © 2001–2018 The Apache Software Foundation. All rights reserved.