code: private void flush(Consumer<Result> outputFn) {
      Result r = results.poll();
      while (r != null) {
        outputFn.accept(r);
        resultCount++;
        r = results.poll();
      }
    }
docs: Flush pending errors and results