public class TransactionContext extends Object
Constructor and Description |
---|
TransactionContext(TransactionRegistry transactionRegistry,
Transaction transaction)
Creates a TransactionContext for the specified Transaction and TransactionRegistry.
|
Modifier and Type | Method and Description |
---|---|
void |
addTransactionContextListener(TransactionContextListener listener)
Adds a listener for transaction completion events.
|
Connection |
getSharedConnection()
Gets the connection shared by all ManagedConnections in the transaction.
|
boolean |
isActive()
True if the transaction is active or marked for rollback only.
|
void |
setSharedConnection(Connection sharedConnection)
Sets the shared connection for this transaction.
|
public TransactionContext(TransactionRegistry transactionRegistry, Transaction transaction)
transactionRegistry
- the TransactionRegistry used to obtain the XAResource for the
shared connectiontransaction
- the transactionpublic Connection getSharedConnection()
public void setSharedConnection(Connection sharedConnection) throws SQLException
sharedConnection
- the shared connectionSQLException
- if a shared connection is already set, if XAResource for the connection
could not be found in the transaction registry, or if there was a problem enlisting the
connection in the transactionpublic void addTransactionContextListener(TransactionContextListener listener) throws SQLException
listener
- the listener to addSQLException
- if a problem occurs adding the listener to the transactionpublic boolean isActive() throws SQLException
SQLException
- if a problem occurs obtaining the transaction statusCopyright © 2001–2015 The Apache Software Foundation. All rights reserved.