Class HistoryFileManager
java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.mapreduce.v2.hs.HistoryFileManager
- All Implemented Interfaces:
Closeable,AutoCloseable,Service
This class provides a way to interact with history files in a thread safe
manor.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassorg.apache.hadoop.mapreduce.v2.hs.HistoryFileManager.HistoryFileInfoNested classes/interfaces inherited from interface org.apache.hadoop.service.Service
Service.STATE -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.hadoop.mapreduce.v2.hs.HistoryFileManager.JobListCacheprotected ThreadPoolExecutor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.hadoop.mapreduce.v2.hs.HistoryFileManager.HistoryFileInfocreateHistoryFileInfo(Path historyFile, Path confFile, Path summaryFile, org.apache.hadoop.mapreduce.v2.jobhistory.JobIndexInfo jobIndexInfo, boolean isInDone) protected org.apache.hadoop.mapreduce.v2.hs.HistoryFileManager.JobListCacheprotected ThreadPoolExecutorcreateMoveToDoneThreadPool(int numMoveThreads) protected booleandeleteDir(FileStatus serialDir) protected List<FileStatus>Finds all history directories with a timestamp component by scanning the filesystem.Collection<org.apache.hadoop.mapreduce.v2.hs.HistoryFileManager.HistoryFileInfo>org.apache.hadoop.mapreduce.v2.hs.HistoryFileManager.HistoryFileInfogetFileInfo(org.apache.hadoop.mapreduce.v2.api.records.JobId jobId) protected static List<FileStatus>scanDirectory(Path path, FileContext fc, PathFilter pathFilter) protected List<FileStatus>scanDirectoryForHistoryFiles(Path path, FileContext fc) protected voidserviceInit(Configuration conf) All initialization code needed by a service.voidActions called during the transition to the STOPPED state.Methods inherited from class org.apache.hadoop.service.AbstractService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, serviceStart, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
-
Field Details
-
jobListCache
protected org.apache.hadoop.mapreduce.v2.hs.HistoryFileManager.JobListCache jobListCache -
moveToDoneExecutor
-
-
Constructor Details
-
HistoryFileManager
public HistoryFileManager()
-
-
Method Details
-
serviceInit
Description copied from class:AbstractServiceAll 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 inAbstractService.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:
serviceInitin classAbstractService- Parameters:
conf- configuration- Throws:
Exception- on a failure -these will be caught, possibly wrapped, and will trigger a service stop
-
createMoveToDoneThreadPool
-
serviceStop
Description copied from class:AbstractServiceActions 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 inAbstractService.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:
serviceStopin classAbstractService- Throws:
Exception- if needed -these will be caught and logged.
-
createJobListCache
protected org.apache.hadoop.mapreduce.v2.hs.HistoryFileManager.JobListCache createJobListCache() -
createHistoryFileInfo
-
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
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
protected boolean deleteDir(FileStatus serialDir) throws AccessControlException, FileNotFoundException, UnsupportedFileSystemException, IOException
-