Class ManagedDataSource<C extends Connection>

java.lang.Object
org.apache.commons.dbcp2.PoolingDataSource<C>
org.apache.commons.dbcp2.managed.ManagedDataSource<C>
Type Parameters:
C - The kind of Connection to manage.
All Implemented Interfaces:
AutoCloseable, Wrapper, CommonDataSource, DataSource

public class ManagedDataSource<C extends Connection> extends PoolingDataSource<C>
The ManagedDataSource is a PoolingDataSource that creates ManagedConnections.
Since:
2.0
  • Constructor Details

    • ManagedDataSource

      public ManagedDataSource(ObjectPool<C> pool, TransactionRegistry transactionRegistry)
      Creates a ManagedDataSource which obtains connections from the specified pool and manages them using the specified transaction registry. The TransactionRegistry must be the transaction registry obtained from the XAConnectionFactory used to create the connection pool. If not, an error will occur when attempting to use the connection in a global transaction because the XAResource object associated with the connection will be unavailable.
      Parameters:
      pool - the connection pool
      transactionRegistry - the transaction registry obtained from the XAConnectionFactory used to create the connection pool object factory
  • Method Details