private long getLastTimeStamp ( Path pathToCheck ) { long lastTimeStamp = - 1 ; long tmpTimeStamp = - 1 ; try { for ( FileStatus fileStat : fs . listStatus ( pathToCheck ) ) { Path srcPath = fileStat . getPath ( ) ; if ( ! fileStat . isDir ( ) ) { boolean checkFlag = true ; if ( release_pattern != null ) { // just need to check the files that match the pattern Matcher m = release_pattern . matcher ( srcPath . toString ( ) ) ; if ( ! m . find ( ) ) { checkFlag = false ; } } if ( checkFlag ) { tmpTimeStamp = fileStat . getModificationTime ( ) ; } else { continue ; } } else { tmpTimeStamp = getLastTimeStamp ( srcPath ) ; } if ( tmpTimeStamp > lastTimeStamp ) { lastTimeStamp = tmpTimeStamp ; } } } catch ( IOException ioe ) { LOG . error ( "IOException when checking timestamp " , ioe ) ; } return lastTimeStamp ; }
Get the release directory s latest timestamp