Class ManagedDataSource

  • All Implemented Interfaces:
    java.sql.Wrapper, javax.sql.CommonDataSource, javax.sql.DataSource

    public class ManagedDataSource
    extends PoolingDataSource
    The ManagedDataSource is a PoolingDataSource that creates ManagedConnections.
    Version:
    $Revision$
    Author:
    Dain Sundstrom
    • Constructor Detail

      • ManagedDataSource

        public ManagedDataSource()
        Creates an uninitialized datasource. Before this data source can be used a pool and transaction registry must be set.
      • ManagedDataSource

        public ManagedDataSource​(org.apache.commons.pool.ObjectPool 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 occure 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 Detail

      • setTransactionRegistry

        public void setTransactionRegistry​(TransactionRegistry transactionRegistry)
        Sets the transaction registry from the XAConnectionFactory used to create the pool. The transaction registry can only be set once using either a connector or this setter method.
        Parameters:
        transactionRegistry - the transaction registry acquired from the XAConnectionFactory used to create the pool
      • getConnection

        public java.sql.Connection getConnection()
                                          throws java.sql.SQLException
        Description copied from class: PoolingDataSource
        Return a Connection from my pool, according to the contract specified by ObjectPool.borrowObject().
        Specified by:
        getConnection in interface javax.sql.DataSource
        Overrides:
        getConnection in class PoolingDataSource
        Throws:
        java.sql.SQLException