Class JdbcExternalConnectionPool


  • public class JdbcExternalConnectionPool
    extends ExternalConnectionPool
    JdbcExternalConnectionPool manages all the functionality of the Apache JDBC Connection Pool. This class can handle different pools (data sources) at the same time. All these pools are eventually making use of the Apache JDBC Connection Pool. This class provides convenience methods to get a connection from a pool, close the different pools and other actions.
    • Constructor Detail

      • JdbcExternalConnectionPool

        public JdbcExternalConnectionPool()
    • Method Detail

      • loadInterceptors

        public void loadInterceptors​(List<PoolInterceptorProvider> interceptors)
        This method loads all the interceptors of Apache JDBC Connection Pool injected with weld.
        Overrides:
        loadInterceptors in class ExternalConnectionPool
        Parameters:
        interceptors - List of PoolInterceptorProvider comprised of all the interceptors injected with Weld
      • getDataSource

        public org.apache.tomcat.jdbc.pool.DataSource getDataSource()
        Gets the default data source, which was obtained from the Apache JDBC Connection Pool.
        Returns:
        the DataSource of the default pool
      • getConnection

        public Connection getConnection()
        This method provides a connection from the default pool. The connection pool is initialized in the first call to this method. a Connection retrieved from the default pool
        Specified by:
        getConnection in class ExternalConnectionPool
        Returns:
        A Connection from the external connection pool
      • getConnection

        public Connection getConnection​(String poolName)
        This method provides a connection from the pool whose name is specified as parameter. The connection pool is initialized in the first call to this method.
        Overrides:
        getConnection in class ExternalConnectionPool
        Parameters:
        poolName - the name of the pool used to retrieve the connection
        Returns:
        a Connection retrieved from the pool passed as parameter
      • closePool

        public void closePool()
        This method closes all the data sources retrieved from the Apache JDBC Connection Pool.
        Overrides:
        closePool in class ExternalConnectionPool