code: private MariaDbPooledConnection getIdleConnection(long timeout, TimeUnit timeUnit)
        throws InterruptedException {
  
      while (true) {
        MariaDbPooledConnection item =
                (timeout == 0) ? idleConnections.pollFirst() : idleConnections.pollFirst(timeout, timeUnit);
  
        if (item != null) {
          MariaDbConnection connection = item.getConnection();
          try {
            if (TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - item.getLastUsed().get())
                    > options.poolValidMinDelay) {
  
              //validate connection
              if (connection.isValid(10)) { //10 seconds timeout
                item.lastUsedToNow();
                return item;
              }
  
            } else {
  
              // connection has been retrieved recently -> skip connection validation
              item.lastUsedToNow();
              return item;
  
            }
  
          } catch (SQLException sqle) {
            //eat
          }
  
          totalConnection.decrementAndGet();
  
          // validation failed
          silentAbortConnection(item);
          addConnectionRequest();
          if (logger.isDebugEnabled()) {
            logger.debug(
                    "pool {} connection removed from pool due to failed validation (total:{}, active:{}, pending:{})",
                    poolTag, totalConnection.get(), getActiveConnections(), pendingRequestNumber.get());
          }
          continue;
        }
  
        return null;
  
      }
    }
docs: Get an existing idle connection in pool.
  
  @return an IDLE connection.