* Is the process with PID pid still alive?
*/
private boolean isAlive(Integer pid) {
// This method assumes that isAlive is called on a pid that was alive not
// too long ago, and hence assumes no chance of pid-wrapping-around.
ShellCommandExecutor shexec = null;
try {
String[] args = { "kill", "-0", pid.toString() };
shexec = new ShellCommandExecutor(args);
shexec.execute();
} catch (ExitCodeException ee) {
return false;
} catch (IOException ioe) {
LOG.warn("Error executing shell command "
+ Arrays.toString(shexec.getExecString()) + ioe);
return false;
}
return (shexec.getExitCode() == 0 ? true : false);
}