Class HistoryFileManager

java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.mapreduce.v2.hs.HistoryFileManager
All Implemented Interfaces:
Closeable, AutoCloseable, Service

@Public @Unstable public class HistoryFileManager extends AbstractService
This class provides a way to interact with history files in a thread safe manor.
  • Field Details

    • jobListCache

      protected org.apache.hadoop.mapreduce.v2.hs.HistoryFileManager.JobListCache jobListCache
    • moveToDoneExecutor

      @VisibleForTesting protected ThreadPoolExecutor moveToDoneExecutor
  • Constructor Details

    • HistoryFileManager

      public HistoryFileManager()
  • Method Details

    • serviceInit

      protected void serviceInit(Configuration conf) throws Exception
      Description copied from class: AbstractService
      All initialization code needed by a service. This method will only ever be called once during the lifecycle of a specific service instance. Implementations do not need to be synchronized as the logic in AbstractService.init(Configuration) prevents re-entrancy. The base implementation checks to see if the subclass has created a new configuration instance, and if so, updates the base class value
      Overrides:
      serviceInit in class AbstractService
      Parameters:
      conf - configuration
      Throws:
      Exception - on a failure -these will be caught, possibly wrapped, and will trigger a service stop
    • createMoveToDoneThreadPool

      protected ThreadPoolExecutor createMoveToDoneThreadPool(int numMoveThreads)
    • serviceStop

      public void serviceStop() throws Exception
      Description copied from class: AbstractService
      Actions called during the transition to the STOPPED state. This method will only ever be called once during the lifecycle of a specific service instance. Implementations do not need to be synchronized as the logic in AbstractService.stop() prevents re-entrancy. Implementations MUST write this to be robust against failures, including checks for null references -and for the first failure to not stop other attempts to shut down parts of the service.
      Overrides:
      serviceStop in class AbstractService
      Throws:
      Exception - if needed -these will be caught and logged.
    • createJobListCache

      protected org.apache.hadoop.mapreduce.v2.hs.HistoryFileManager.JobListCache createJobListCache()
    • createHistoryFileInfo

      protected org.apache.hadoop.mapreduce.v2.hs.HistoryFileManager.HistoryFileInfo createHistoryFileInfo(Path historyFile, Path confFile, Path summaryFile, org.apache.hadoop.mapreduce.v2.jobhistory.JobIndexInfo jobIndexInfo, boolean isInDone)
    • scanDirectory

      @VisibleForTesting protected static List<FileStatus> scanDirectory(Path path, FileContext fc, PathFilter pathFilter) throws IOException
      Throws:
      IOException
    • scanDirectoryForHistoryFiles

      protected List<FileStatus> scanDirectoryForHistoryFiles(Path path, FileContext fc) throws IOException
      Throws:
      IOException
    • findTimestampedDirectories

      protected List<FileStatus> findTimestampedDirectories() throws IOException
      Finds all history directories with a timestamp component by scanning the filesystem. Used when the JobHistory server is started.
      Returns:
      list of history directories
      Throws:
      IOException
    • getAllFileInfo

      public Collection<org.apache.hadoop.mapreduce.v2.hs.HistoryFileManager.HistoryFileInfo> getAllFileInfo() throws IOException
      Throws:
      IOException
    • getFileInfo

      public org.apache.hadoop.mapreduce.v2.hs.HistoryFileManager.HistoryFileInfo getFileInfo(org.apache.hadoop.mapreduce.v2.api.records.JobId jobId) throws IOException
      Throws:
      IOException
    • deleteDir

      Throws:
      AccessControlException
      FileNotFoundException
      UnsupportedFileSystemException
      IOException