Package org.apache.commons.dbcp2.managed
Class LocalXAConnectionFactory
java.lang.Object
org.apache.commons.dbcp2.managed.LocalXAConnectionFactory
- All Implemented Interfaces:
ConnectionFactory
,XAConnectionFactory
An implementation of XAConnectionFactory which manages non-XA connections in XA transactions. A non-XA connection
commits and rolls back as part of the XA transaction, but is not recoverable since the connection does not implement
the 2-phase protocol.
- Since:
- 2.0
- Version:
- $Id: LocalXAConnectionFactory.java 1660791 2015-02-19 04:13:10Z psteitz $
- Author:
- Dain Sundstrom
-
Constructor Summary
ConstructorsConstructorDescriptionLocalXAConnectionFactory
(javax.transaction.TransactionManager transactionManager, ConnectionFactory connectionFactory) Creates an LocalXAConnectionFactory which uses the specified connection factory to create database connections. -
Method Summary
Modifier and TypeMethodDescriptionCreate a newConnection
in an implementation specific fashion.Gets the TransactionRegistry for this connection factory which contains a the XAResource for every connection created by this factory.
-
Constructor Details
-
LocalXAConnectionFactory
public LocalXAConnectionFactory(javax.transaction.TransactionManager transactionManager, ConnectionFactory connectionFactory) Creates an LocalXAConnectionFactory which uses the specified connection factory to create database connections. The connections are enlisted into transactions using the specified transaction manager.- Parameters:
transactionManager
- the transaction manager in which connections will be enlistedconnectionFactory
- the connection factory from which connections will be retrieved
-
-
Method Details
-
getTransactionRegistry
Description copied from interface:XAConnectionFactory
Gets the TransactionRegistry for this connection factory which contains a the XAResource for every connection created by this factory.- Specified by:
getTransactionRegistry
in interfaceXAConnectionFactory
- Returns:
- the transaction registry for this connection factory
-
createConnection
Description copied from interface:XAConnectionFactory
Create a newConnection
in an implementation specific fashion.An implementation can assume that the caller of this will wrap the connection in a proxy that protects access to the setAutoCommit, commit and rollback when enrolled in a XA transaction.
- Specified by:
createConnection
in interfaceConnectionFactory
- Specified by:
createConnection
in interfaceXAConnectionFactory
- Returns:
- a new
Connection
- Throws:
SQLException
- if a database error occurs creating the connection
-