Class LocalXAConnectionFactory
- java.lang.Object
- 
- org.apache.tomcat.dbcp.dbcp2.managed.LocalXAConnectionFactory
 
- 
- All Implemented Interfaces:
- ConnectionFactory,- XAConnectionFactory
 
 public class LocalXAConnectionFactory extends java.lang.Object implements 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
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected static classLocalXAConnectionFactory.LocalXAResourceLocalXAResource is a fake XAResource for non-XA connections.
 - 
Constructor SummaryConstructors Constructor Description LocalXAConnectionFactory(TransactionManager transactionManager, TransactionSynchronizationRegistry transactionSynchronizationRegistry, ConnectionFactory connectionFactory)Creates an LocalXAConnectionFactory which uses the specified connection factory to create database connections.LocalXAConnectionFactory(TransactionManager transactionManager, ConnectionFactory connectionFactory)Creates an LocalXAConnectionFactory which uses the specified connection factory to create database connections.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description java.sql.ConnectioncreateConnection()Create a newConnectionin an implementation specific fashion.ConnectionFactorygetConnectionFactory()TransactionRegistrygetTransactionRegistry()Gets the TransactionRegistry for this connection factory which contains a the XAResource for every connection created by this factory.
 
- 
- 
- 
Constructor Detail- 
LocalXAConnectionFactorypublic LocalXAConnectionFactory(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 enlisted
- connectionFactory- the connection factory from which connections will be retrieved
 
 - 
LocalXAConnectionFactorypublic LocalXAConnectionFactory(TransactionManager transactionManager, TransactionSynchronizationRegistry transactionSynchronizationRegistry, 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 enlisted
- transactionSynchronizationRegistry- the optional TSR to register synchronizations with
- connectionFactory- the connection factory from which connections will be retrieved
- Since:
- 2.8.0
 
 
- 
 - 
Method Detail- 
createConnectionpublic java.sql.Connection createConnection() throws java.sql.SQLExceptionDescription copied from interface:XAConnectionFactoryCreate a newConnectionin 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:
- createConnectionin interface- ConnectionFactory
- Specified by:
- createConnectionin interface- XAConnectionFactory
- Returns:
- a new Connection
- Throws:
- java.sql.SQLException- if a database error occurs creating the connection
 
 - 
getConnectionFactorypublic ConnectionFactory getConnectionFactory() - Returns:
- The connection factory.
- Since:
- 2.6.0
 
 - 
getTransactionRegistrypublic TransactionRegistry getTransactionRegistry() Description copied from interface:XAConnectionFactoryGets the TransactionRegistry for this connection factory which contains a the XAResource for every connection created by this factory.- Specified by:
- getTransactionRegistryin interface- XAConnectionFactory
- Returns:
- the transaction registry for this connection factory
 
 
- 
 
-