private static void archiveFilesConcurrently(Configuration conf, Path baseArchiveDir,
    List<File> files, Queue<File> failures, String startTime) {
    LOG.trace("Archiving {} files concurrently into directory: {}", files.size(), baseArchiveDir);
    Map<File, Future<Boolean>> futureMap = new HashMap<>();
    // Submit file archiving tasks
    // default is 16 which comes equal hbase.hstore.blockingStoreFiles default value
    int maxThreads = conf.getInt("hbase.hfilearchiver.per.region.thread.pool.max", 16);
    ThreadPoolExecutor hfilesArchiveExecutor = Threads.getBoundedCachedThreadPool(maxThreads, 30L,
      TimeUnit.SECONDS, getThreadFactory("HFileArchiverPerRegion-"));
    try {
      for (File file : files) {
        Future<Boolean> future = hfilesArchiveExecutor
          .submit(() -> resolveAndArchiveFile(baseArchiveDir, file, startTime));
        futureMap.put(file, future);
      }

      // Process results of each task
      for (Map.Entry<File, Future<Boolean>> entry : futureMap.entrySet()) {
        File file = entry.getKey();
        try {
          if (!entry.getValue().get()) {
            LOG.warn("Failed to archive file: {} into directory: {}", file, baseArchiveDir);
            failures.add(file);
          }
        } catch (InterruptedException e) {
          LOG.error("Archiving interrupted for file: {}", file, e);
          Thread.currentThread().interrupt(); // Restore interrupt status
          failures.add(file);
        } catch (ExecutionException e) {
          LOG.error("Archiving failed for file: {}", file, e);
          failures.add(file);
        }
      }
    } finally {
      hfilesArchiveExecutor.shutdown();
    }
  }
Resolve any conflict with an existing archive file via timestamp-append renaming of the
existing file and then archive the passed in files.
@param fs             {@link FileSystem} on which to archive the files
@param baseArchiveDir base archive directory to store the files. If any of the files to archive
                      are directories, will append the name of the directory to the base
                      archive directory name, creating a parallel structure.
@param toArchive      files/directories that need to be archvied
@param start          time the archiving started - used for resolving archive conflicts.
@return the list of failed to archive files.
@throws IOException if an unexpected file operation exception occurred
hbase-server/src/main/java/org/apache/hadoop/hbase/backup/HFileArchiver.java