code: public MariaDbConnection getConnection() throws SQLException {
  
      pendingRequestNumber.incrementAndGet();
  
      MariaDbPooledConnection pooledConnection;
  
      try {
  
        //try to get Idle connection if any (with a very small timeout)
        if ((pooledConnection = getIdleConnection(totalConnection.get() > 4 ? 0 : 50,
            TimeUnit.MICROSECONDS)) != null) {
          return pooledConnection.getConnection();
        }
  
        // ask for new connection creation if max is not reached
        addConnectionRequest();
  
        //try to create new connection if semaphore permit it
        if ((pooledConnection = getIdleConnection(
            TimeUnit.MILLISECONDS.toNanos(options.connectTimeout),
            TimeUnit.NANOSECONDS)) != null) {
          return pooledConnection.getConnection();
        }
  
        throw ExceptionMapper.connException("No connection available within the specified time "
            + "(option 'connectTimeout': " + NumberFormat.getInstance().format(options.connectTimeout)
            + " ms)");
  
      } catch (InterruptedException interrupted) {
        throw ExceptionMapper.connException("Thread was interrupted", interrupted);
      } finally {
        pendingRequestNumber.decrementAndGet();
      }
  
    }
docs: Retrieve new connection. If possible return idle connection, if not, stack connection query,
  ask for a connection creation, and loop until a connection become idle / a new connection is
  created.
  
  @return a connection object
  @throws SQLException if no connection is created when reaching timeout (connectTimeout option)