if (m_pool == null) {
DatabaseConnectionPool pool = m_pool;  if (pool == null) {
    private java.sql.Connection gimmeConnection()        throws java.sql.SQLException {        if (m_pool == null) {            synchronized (this) {                long since = System.currentTimeMillis() - m_lastAttempt;                if (since > m_interval) {                    m_lastAttempt = System.currentTimeMillis();                    connect();                } else {                    throw new DbNotAvailableException                        ("The database went down. Will reattempt connecting in " +                         (m_interval - since) + " milliseconds.");                }            }        }        int retries = 0;        long time = System.currentTimeMillis();        do {            java.sql.Connection conn = null;            // note that some drivers can be configured            // to block in getConnection, in which case            // this synchronized will be quite a            // bottleneck.  Note that it's not            // an ordered first-come-first-served system            // that determines which of several competing            // threads gets the monitor lock.            // TODO: Consider working on a system for            // controlling the order of who gets this lock?            // TODO: Consider removing this synchronization            // altogether, assuming m_pool is practically            // immutable, and pushing all synchronization            // responsibility down to the DB pool driver.            // Or, maybe switch to wait/notify, see below TODO.            //synchronized(ConnectionManager.class) {            try {                conn = m_pool.getConnection();            } catch (SQLException e) {                SQLException wrapped = SQLExceptionHandler.wrap(e);                if (wrapped instanceof DbNotAvailableException) {                    disconnect();                }                throw wrapped;            }            //}            if (LOG.isInfoEnabled()) {                long newtime = System.currentTimeMillis() - time;                LOG.info("getConnection(). Executed in " + newtime +                         " total ms. across " + retries + " retries");                Throwable t = new Throwable("getConnection stack trace");                LOG.debug(null, t);            }            // Wrap the connection object with our implementation.            if (conn == null) {                retries++;                if (retries <= m_retryLimit) {                    LOG.warn("Unable to get connection, sleeping (retry #" +                             retries + ")");                    try {                        // TODO: consider synchronizing and changing this to                        // a wait/notify relationship, instead of the current                        // polling system.                        Thread.sleep(m_retrySleep);                    } catch (InterruptedException e) {                        // ignore                    }                } else {                    LOG.warn("Unable to get connection, giving up " +                             "(beyond retry limit at #" + retries + ")");                    throw new java.sql.SQLException("Unable to get connection");                }            } else {                // TODO: set threadlocal connection here once we have SDM #149294.                return conn;            }            // this is an ugly loop end; the exits are both earlier, either via            // throwing an exception or returning a successful connection.            // looping will occur if conn is null and retrylimit has not            // been exceeded.        } while (true);    }