public void delete(HistoryFileInfo fileInfo) { if (LogGlobal.isDebugEnabled()) { /* LOG.debug("Removing from cache "+fileInfo) */ LOG.removing_from_cache(fileInfo.toString()).debug(); } cache.remove(fileInfo.getJobId()); }
/** * Scans the specified path and populates the intermediate cache. * * @param absPath * @throws IOException */ private void scanIntermediateDirectory(final Path absPath) throws IOException { if (LogGlobal.isDebugEnabled()) { /* LOG.debug("Scanning intermediate dir "+absPath) */ LOG.scanning_intermediate_dir(absPath.toString()).debug(); } List<FileStatus> fileStatusList = scanDirectoryForHistoryFiles(absPath, intermediateDoneDirFc); if (LogGlobal.isDebugEnabled()) { /* LOG.debug("Found "+fileStatusList.size()+" files") */ LOG.found_files(String.valueOf(fileStatusList.size())).tag("methodCall").debug(); } for (FileStatus fs : fileStatusList) { if (LogGlobal.isDebugEnabled()) { /* LOG.debug("scanning file: "+fs.getPath()) */ LOG.scanning_file(String.valueOf(fs.getPath())).tag("methodCall").debug(); } JobIndexInfo jobIndexInfo = FileNameIndexUtils.getIndexInfo(fs.getPath().getName()); String confFileName = JobHistoryUtils.getIntermediateConfFileName(jobIndexInfo.getJobId()); String summaryFileName = JobHistoryUtils.getIntermediateSummaryFileName(jobIndexInfo.getJobId()); HistoryFileInfo fileInfo = new HistoryFileInfo( fs.getPath(), new Path(fs.getPath().getParent(), confFileName), new Path(fs.getPath().getParent(), summaryFileName), jobIndexInfo, false); final HistoryFileInfo old = jobListCache.addIfAbsent(fileInfo); if (old == null || old.didMoveFail()) { final HistoryFileInfo found = (old == null) ? fileInfo : old; long cutoff = System.currentTimeMillis() - maxHistoryAge; if (found.getJobIndexInfo().getFinishTime() <= cutoff) { try { found.delete(); } catch (IOException e) { /* LOG.warn("Error cleaning up a HistoryFile that is out of date.",e) */ LOG.error_cleaning_historyfile_that_out_date(e.toString()).warn(); } } else { if (LogGlobal.isDebugEnabled()) { /* LOG.debug("Scheduling move to done of "+found) */ LOG.scheduling_move_done(found.toString()).debug(); } moveToDoneExecutor.execute( new Runnable() { @Override public void run() { try { found.moveToDone(); } catch (IOException e) { /* LOG.info("Failed to process fileInfo for job: "+found.getJobId(),e) */ LOG.failed_process_fileinfo_for_job( String.valueOf(found.getJobId()), e.toString()) .tag("methodCall") .info(); } } }); } } else if (old != null && !old.isMovePending()) { // This is a duplicate so just delete it if (LogGlobal.isDebugEnabled()) { /* LOG.debug("Duplicate: deleting") */ LOG.duplicate_deleting().debug(); } fileInfo.delete(); } } }