code: public void close() throws InterruptedException {
      synchronized (this) {
        Pools.remove(this);
        poolState.set(POOL_STATE_CLOSING);
        pendingRequestNumber.set(0);
  
        scheduledFuture.cancel(false);
        connectionAppender.shutdown();
  
        try {
          connectionAppender.awaitTermination(10, TimeUnit.SECONDS);
        } catch (InterruptedException i) {
          //eat
        }
  
        if (logger.isInfoEnabled()) {
          logger.info("closing pool {} (total:{}, active:{}, pending:{})",
              poolTag, totalConnection.get(), getActiveConnections(), pendingRequestNumber.get());
        }
  
        ExecutorService connectionRemover = new ThreadPoolExecutor(totalConnection.get(),
            options.maxPoolSize, 10, TimeUnit.SECONDS,
            new LinkedBlockingQueue<>(options.maxPoolSize),
            new MariaDbThreadFactory(poolTag + "-destroyer"));
  
        //loop for up to 10 seconds to close not used connection
        long start = System.nanoTime();
        do {
          closeAll(connectionRemover, idleConnections);
          if (totalConnection.get() > 0) {
            Thread.sleep(0, 10_00);
          }
        } while (totalConnection.get() > 0
            && TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - start) < 10);
  
        //after having wait for 10 seconds, force removal, even if used connections
        if (totalConnection.get() > 0 || idleConnections.isEmpty()) {
          closeAll(connectionRemover, idleConnections);
        }
  
        connectionRemover.shutdown();
        try {
          unRegisterJmx();
        } catch (Exception exception) {
          //eat
        }
        connectionRemover.awaitTermination(10, TimeUnit.SECONDS);
      }
    }
docs: Close pool and underlying connections.
  
  @throws InterruptedException if interrupted