@Override
    public void close() {
      try {
        if (asyncTasks != null) {
          CompletableFuture.allOf(asyncTasks.toArray(new CompletableFuture[0])).get();
        }
      } catch (InterruptedException e) {
        LOG.info("Interrupted while generating splits", e);
        Thread.currentThread().interrupt();
      } catch (ExecutionException e) {// ExecutionException wraps the original exception
        LOG.error("Exception while generating splits", e.getCause());
        throw new RuntimeException(e.getCause());
      } finally {
        if (executor != null) {
          executor.shutdown();
        }
      }
    }
SplitSerializer is a helper class for taking care of serializing splits to the tez scratch dir
when a size criteria defined by "hive.tez.input.fs.serialization.threshold" is met.
It utilizes an ExecutorService for parallel writes to prevent a single split write operation
becoming the bottleneck (as write() is called from a loop currently).
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/HiveSplitGenerator.java