private List<FileStatus> submitRaidJobsWhenPossible(PolicyInfo info,
      List<FileStatus> filesToRaid, boolean submitAll) {
    if (!submitRaidJobs || !info.getShouldRaid()) {
      return filesToRaid;
    }
    try {
      int maxFilesPerJob = configManager.getMaxFilesPerJob();
      int maxJobs = configManager.getMaxJobsPerPolicy();
      while (!filesToRaid.isEmpty() &&
          (submitAll || filesToRaid.size() >= maxFilesPerJob) &&
          raidNode.getRunningJobsForPolicy(info.getName()) < maxJobs) {
        int numFiles = Math.min(maxFilesPerJob, filesToRaid.size());
        LOG.info("Invoking raidFiles with " + numFiles + " files");
        raidNode.raidFiles(info, filesToRaid.subList(0, numFiles));
        filesToRaid =
            filesToRaid.subList(numFiles, filesToRaid.size());

      }
    } catch (IOException e) {
      LOG.warn("Failed to raid files for policy:" + info.getName(), e);
    }
    return filesToRaid;
  }
private List < FileStatus > submitRaidJobsWhenPossible ( PolicyInfo info , List < FileStatus > filesToRaid , boolean submitAll ) { if ( ! submitRaidJobs || ! info . getShouldRaid ( ) ) { return filesToRaid ; } try { int maxFilesPerJob = configManager . getMaxFilesPerJob ( ) ; int maxJobs = configManager . getMaxJobsPerPolicy ( ) ; while ( ! filesToRaid . isEmpty ( ) && ( submitAll || filesToRaid . size ( ) >= maxFilesPerJob ) && raidNode . getRunningJobsForPolicy ( info . getName ( ) ) < maxJobs ) { int numFiles = Math . min ( maxFilesPerJob , filesToRaid . size ( ) ) ; LOG . info ( "Invoking raidFiles with " + numFiles + " files" ) ; raidNode . raidFiles ( info , filesToRaid . subList ( 0 , numFiles ) ) ; filesToRaid = filesToRaid . subList ( numFiles , filesToRaid . size ( ) ) ; } } catch ( IOException e ) { LOG . warn ( "Failed to raid files for policy:" + info . getName ( ) , e ) ; } return filesToRaid ; }
Raiding a given list of files
@param info The Raid policy
@param filesToRaid The list of files to raid
@param submitAll Should submit the whole list?
@return The remaining files to raid