docs: private Connection getPooledConnection() throws SQLException {
      PooledConnection pc = null;
      synchronized (lock) {
        if (available == null) {
          throw new PSQLException(GT.tr("DataSource has been closed."),
              PSQLState.CONNECTION_DOES_NOT_EXIST);
        }
        while (true) {
          if (!available.isEmpty()) {
            pc = available.pop();
            used.push(pc);
            break;
          }
          if (maxConnections == 0 || used.size() < maxConnections) {
            pc = source.getPooledConnection();
            used.push(pc);
            break;
          } else {
            try {
              // Wake up every second at a minimum
              lock.wait(1000L);
            } catch (InterruptedException e) {
            }
          }
        }
      }
      pc.addConnectionEventListener(connectionEventListener);
      return pc.getConnection();
    }