code: public static LogEntry getLastEntryIfStale(FileSystem fs, Path lockFile, long olderThan)
            throws IOException {
      long modifiedTime = fs.getFileStatus(lockFile).getModificationTime();
      if( modifiedTime <= olderThan ) { // look
        //Impt: HDFS timestamp may not reflect recent appends, so we double check the
        // timestamp in last line of file to see when the last update was made
        LogEntry lastEntry =  getLastEntry(fs, lockFile);
        if(lastEntry==null) {
          LOG.warn("Empty lock file found. Deleting it. {}", lockFile);
          try {
            if(!fs.delete(lockFile, false))
              throw new IOException("Empty lock file deletion failed");
          } catch (Exception e) {
            LOG.error("Unable to delete empty lock file " + lockFile, e);
          }
        }
        if( lastEntry.eventTime <= olderThan )
          return lastEntry;
      }
      return null;
    }
docs: checks if lockFile is older than 'olderThan' UTC time by examining the modification time
  on file and (if necessary) the timestamp in last log entry in the file. If its stale, then
  returns the last log entry, else returns null.
  @param fs
  @param lockFile
  @param olderThan  time (millis) in UTC.
  @return the last entry in the file if its too old. null if last entry is not too old
  @throws IOException