public Connection getProxyConnection(long timeoutMs) throws SQLException {
        int attempt = 1;
        ConnHolder connHolder = null;
        SQLException sqlException = null;
        long startNanoTime = System.nanoTime();

        while (connHolder == null) {
            try {
                connHolder = getConnHolder(timeoutMs);

            } catch (ViburDBCPException e) { // thrown only if we can retry the operation, see getConnHolder(...)
                sqlException = chainSQLException(e.unwrapSQLException(), sqlException);

                if (attempt++ > dataSource.getAcquireRetryAttempts()) { // check the max retries limit
                    throw sqlException;
                }
                if (timeoutMs > 0) { // check the time limit if applicable
                    timeoutMs = NANOSECONDS.toMillis(connectionTimeoutInNanos - (System.nanoTime() - startNanoTime))
                            - dataSource.getAcquireRetryDelayInMs(); // calculates the remaining timeout
                    if (timeoutMs <= 0) {
                        throw sqlException;
                    }
                }

                try {
                    MILLISECONDS.sleep(dataSource.getAcquireRetryDelayInMs());
                } catch (InterruptedException ie) {
                    Thread.currentThread().interrupt();
                    throw chainSQLException(new SQLException(ie), sqlException);
                }
            }
        }

        if (logger.isTraceEnabled()) {
            logger.trace("Taking rawConnection {}", connHolder.rawConnection());
        }

        Connection proxy = newProxyConnection(connHolder, this, dataSource);
        if (dataSource.isPoolEnableConnectionTracking()) {
            connHolder.setProxyConnection(proxy);
        }
        return proxy;
    }
public Connection getProxyConnection ( long timeoutMs ) throws SQLException { int attempt = 1 ; ConnHolder connHolder = null ; SQLException sqlException = null ; long startNanoTime = System . nanoTime ( ) ; while ( connHolder == null ) { try { connHolder = getConnHolder ( timeoutMs ) ; } catch ( ViburDBCPException e ) { sqlException = chainSQLException ( e . unwrapSQLException ( ) , sqlException ) ; if ( attempt ++ > dataSource . getAcquireRetryAttempts ( ) ) { throw sqlException ; } if ( timeoutMs > 0 ) { timeoutMs = NANOSECONDS . toMillis ( connectionTimeoutInNanos - ( System . nanoTime ( ) - startNanoTime ) ) - dataSource . getAcquireRetryDelayInMs ( ) ; if ( timeoutMs <= 0 ) { throw sqlException ; } } try { MILLISECONDS . sleep ( dataSource . getAcquireRetryDelayInMs ( ) ) ; } catch ( InterruptedException ie ) { Thread . currentThread ( ) . interrupt ( ) ; throw chainSQLException ( new SQLException ( ie ) , sqlException ) ; } } } if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Taking rawConnection {}" , connHolder . rawConnection ( ) ) ; } Connection proxy = newProxyConnection ( connHolder , this , dataSource ) ; if ( dataSource . isPoolEnableConnectionTracking ( ) ) { connHolder . setProxyConnection ( proxy ) ; } return proxy ; }
//////////// getProxyConnection(...) //////////////