Class ConnectionPool

    • Constructor Detail

      • ConnectionPool

        public ConnectionPool​(String strName,
                              String strUrl,
                              String strUser,
                              String strPassword,
                              int nMaxConns,
                              int nInitConns,
                              int nTimeOut,
                              org.apache.logging.log4j.Logger logger,
                              String strCheckValidConnectionSql)
        Constructor.
        Parameters:
        strName - Nom du pool
        strUrl - JDBC Data source URL
        strUser - SQL User
        strPassword - SQL Password
        nMaxConns - Max connections
        nInitConns - Initials connections
        nTimeOut - Timeout to get a connection
        logger - the Logger object
        strCheckValidConnectionSql - The SQL syntax used for check connexion validatation
    • Method Detail

      • freeConnection

        public void freeConnection​(Connection conn)
        Returns a connection to pool.
        Parameters:
        conn - The released connection to return to pool
      • release

        public void release()
        Releases the pool by closing all its connections.
      • getConnectionCount

        public int getConnectionCount()
        Returns the number of connections opened by the pool (available or busy)
        Returns:
        A connection count
      • getFreeConnectionCount

        public int getFreeConnectionCount()
        Returns the number of free connections of the pool (available or busy)
        Returns:
        A connection count
      • getBusyConnectionCount

        public int getBusyConnectionCount()
        Returns the number of busy connections of the pool (available or busy)
        Returns:
        A connection count
      • getMaxConnectionCount

        public int getMaxConnectionCount()
        Returns the maximum number of connections of the pool
        Returns:
        A connection count
      • unwrap

        public <T> T unwrap​(Class<T> iface)
                     throws SQLException
        Get the unwrap.
        Specified by:
        unwrap in interface Wrapper
        Type Parameters:
        T - the generic type
        Parameters:
        iface - the iface
        Returns:
        null
        Throws:
        SQLException - the sQL exception
      • getParentLogger

        public Logger getParentLogger()
        Implementation of JDBC 4.1's getParentLogger method (Java 7)
        Specified by:
        getParentLogger in interface CommonDataSource
        Returns:
        the parent logger