private void cleanup(AsyncClusterConnection conn, TableName tableName, Deque<LoadQueueItem> queue,
    ExecutorService pool) throws IOException {
    fsDelegationToken.releaseDelegationToken();
    if (bulkToken != null) {
      conn.cleanupBulkLoad(tableName, bulkToken);
    }
    if (pool != null) {
      pool.shutdown();
    }
    if (!queue.isEmpty()) {
      StringBuilder err = new StringBuilder();
      err.append("-------------------------------------------------\n");
      err.append("Bulk load aborted with some files not yet loaded:\n");
      err.append("-------------------------------------------------\n");
      for (LoadQueueItem q : queue) {
        err.append("  ").append(q.getFilePath()).append('\n');
      }
      LOG.error(err.toString());
    }
  }
If the table is created for the first time, then "completebulkload" reads the files twice. More
modifications necessary if we want to avoid doing it.
hbase-server/src/main/java/org/apache/hadoop/hbase/tool/BulkLoadHFilesTool.java