private void gcFileIfStale(UfsJournalFile file, long checkpointSequenceNumber) {
    if (file.getEnd() > checkpointSequenceNumber && !file.isTmpCheckpoint()) {
      return;
    }

    long lastModifiedTimeMs;
    try {
      lastModifiedTimeMs = mUfs.getFileStatus(file.getLocation().toString()).getLastModifiedTime();
    } catch (IOException e) {
      LOG.warn("Failed to get the last modified time for {}.", file.getLocation());
      return;
    }

    long thresholdMs = file.isTmpCheckpoint()
        ? ServerConfiguration.getMs(PropertyKey.MASTER_JOURNAL_TEMPORARY_FILE_GC_THRESHOLD_MS)
        : ServerConfiguration.getMs(PropertyKey.MASTER_JOURNAL_GC_THRESHOLD_MS);

    if (System.currentTimeMillis() - lastModifiedTimeMs > thresholdMs) {
      deleteNoException(file.getLocation());
    }
  }
private void gcFileIfStale ( UfsJournalFile file , long checkpointSequenceNumber ) { if ( file . getEnd ( ) > checkpointSequenceNumber && ! file . isTmpCheckpoint ( ) ) { return ; } long lastModifiedTimeMs ; try { lastModifiedTimeMs = mUfs . getFileStatus ( file . getLocation ( ) . toString ( ) ) . getLastModifiedTime ( ) ; } catch ( IOException e ) { LOG . warn ( "Failed to get the last modified time for {}." , file . getLocation ( ) ) ; return ; } long thresholdMs = file . isTmpCheckpoint ( ) ? ServerConfiguration . getMs ( PropertyKey . MASTER_JOURNAL_TEMPORARY_FILE_GC_THRESHOLD_MS ) : ServerConfiguration . getMs ( PropertyKey . MASTER_JOURNAL_GC_THRESHOLD_MS ) ; if ( System . currentTimeMillis ( ) - lastModifiedTimeMs > thresholdMs ) { deleteNoException ( file . getLocation ( ) ) ; } }
Garbage collects a file if necessary.

@param file the file
@param checkpointSequenceNumber the first sequence number that has not been checkpointed