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 connectionspublic void registerConnection(Connection connection, XAResource xaResource)
connection
- the JDBC connectionxaResource
- the XAResource which managed the connection within a transactionpublic XAResource getXAResource(Connection connection) throws SQLException
connection
- the connectionSQLException
- if the connection does not have a registered XAResourcepublic TransactionContext getActiveTransactionContext() throws SQLException
SQLException
- if an error occurs while fetching the transactionpublic void unregisterConnection(Connection connection)
TransactionRegistry
connection
- Copyright © 2001–2017 The Apache Software Foundation. All rights reserved.