code: private SQLException createTimeoutException(long startTime)
     {
        logPoolState("Timeout failure ");
        metricsTracker.recordConnectionTimeout();
  
        String sqlState = null;
        final Throwable originalException = getLastConnectionFailure();
        if (originalException instanceof SQLException) {
           sqlState = ((SQLException) originalException).getSQLState();
        }
        final SQLException connectionException = new SQLTransientConnectionException(poolName + " - Connection is not available, request timed out after " + elapsedMillis(startTime) + "ms.", sqlState, originalException);
        if (originalException instanceof SQLException) {
           connectionException.setNextException((SQLException) originalException);
        }
  
        return connectionException;
     }
docs: Create a timeout exception (specifically, {@link SQLTransientConnectionException}) to be thrown, because a
  timeout occurred when trying to acquire a Connection from the pool.  If there was an underlying cause for the
  timeout, e.g. a SQLException thrown by the driver while trying to create a new Connection, then use the
  SQL State from that exception as our own and additionally set that exception as the "next" SQLException inside
  of our exception.
  
  As a side-effect, log the timeout failure at DEBUG, and record the timeout failure in the metrics tracker.
  
  @param startTime the start time (timestamp) of the acquisition attempt
  @return a SQLException to be thrown from {@link #getConnection()}