private static Long getPid ( File pidFile ) { FileReader reader = null ; BufferedReader lineReader = null ; String pidLine = null ; try { reader = new FileReader ( pidFile ) ; lineReader = new BufferedReader ( reader ) ; pidLine = lineReader . readLine ( ) ; if ( pidLine != null ) { pidLine = pidLine . trim ( ) ; } } catch ( Exception ex ) { log . error ( "Failed to read PID from file [" + pidFile . getAbsolutePath ( ) + "]" , ex ) ; } finally { if ( reader != null ) try { reader . close ( ) ; } catch ( Exception ex ) { /* No Op */ } } try { return Long . parseLong ( pidLine ) ; } catch ( Exception ex ) { return null ; } }
Reads the pid from the specified pid file