private void bulkMoveFiles(final Configuration conf, final FileSystem srcFs, final FileSystem destFs,
      final List<Pair<Path, Path>> pairs) throws IOException {
    if (pairs.isEmpty()) {
      return;
    }
    final boolean canRename = srcFs.getUri().equals(destFs.getUri());
    final List<Future<Pair<Path, Path>>> futures = new LinkedList<>();
    final int moveThreadsCount = conf.getInt(ConfVars.HIVE_MOVE_FILES_THREAD_COUNT.varname, 25);

    if (moveThreadsCount <= 0) {
      for (final Pair<Path, Path> pair: pairs) {
        Path srcP = pair.getLeft();
        Path dstP = pair.getRight();
        if (!moveFile(srcFs, srcP, destFs, dstP, conf, canRename)) {
          throw new HCatException(ErrorType.ERROR_MOVE_FAILED,
              "Unable to move from " + srcP + " to " + dstP);
        }
      }
      return;
    }

    final ExecutorService pool = Executors.newFixedThreadPool(moveThreadsCount,
        new ThreadFactoryBuilder().setDaemon(true).setNameFormat("Move-Thread-%d").build());

    for (final Pair<Path, Path> pair: pairs) {
      Path srcP = pair.getLeft();
      Path dstP = pair.getRight();
      futures.add(pool.submit(new Callable<Pair<Path, Path>>() {
        @Override
        public Pair<Path, Path> call() throws IOException {
          if (moveFile(srcFs, srcP, destFs, dstP, conf, canRename)) {
            return pair;
          } else {
            throw new HCatException(ErrorType.ERROR_MOVE_FAILED,
                "Unable to move from " + srcP + " to " + dstP);
          }
        }
      }));
    }
    pool.shutdown();
    for (Future<Pair<Path, Path>> future : futures) {
      try {
        future.get();
      } catch (Exception e) {
        pool.shutdownNow();
        throw new HCatException(ErrorType.ERROR_MOVE_FAILED, e.getMessage());
      }
    }
  }
Bulk move files from source to destination.
@param srcFs the source filesystem where the source files are
@param destFs the destionation filesystem where the destionation files are
@param pairs list of pairs of <source_path, destination_path>, move source_path to destination_path
@throws java.io.IOException
hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/FileOutputCommitterContainer.java