code: final ConnectionPoolConnection open(final long timeout, final TimeUnit timeoutUnit) throws InterruptedException {
  
        ConnectionPoolConnection conn = timeout >= 0 ? availableQueue.poll(timeout, timeoutUnit) : availableQueue.take();
  
        if(conn != null) {
           if(!testOnLogicalOpen) {
              conn.logicalOpen();
              conn.state.set(ConnectionPoolConnection.STATE_OPEN);
           } else {
              try {
                 conn.logicalOpenWithTest();
                 conn.state.set(ConnectionPoolConnection.STATE_OPEN);
              } catch(SQLException se) {
                 conn.state.set(ConnectionPoolConnection.STATE_REOPENING);
                 stats.connectionErrors.mark();
                 reopen(conn);
                 return open(); //Attempt to open another connection.
              }
           }
        }
  
        return conn;
     }
docs: Opens a connection by obtaining one from the available queue.
  <p>
  If no connection becomes available before the specified wait time,
  {@code null} is returned. If specified wait time < 0, waits indefinitely
  for a connection to become available.
  </p>
  @param timeout The timeout value.
  @param timeoutUnit The timeout units.
  @return A connection or {@code null} if none was available in the specified wait time.
  @throws InterruptedException on thread interruption.