Skip to content

Commit

Permalink
NAS-2423 Tunning heritrix shutdown functionalty.
Browse files Browse the repository at this point in the history
  • Loading branch information
mss committed Jul 7, 2015
1 parent 63d2906 commit 834eafa
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -184,13 +184,13 @@ public void stopHeritrix() {
try {
ProcessBuilder processBuilder = new ProcessBuilder("pgrep", "-f", jobName);
log.info("Looking up heritrix process with. " + processBuilder.command());
if (processBuilder.start().exitValue() == 0) {
if (processBuilder.start().waitFor() == 0) {
log.info("Heritrix running, requesting heritrix to stop ignoring running job " + jobName);
h3wrapper.exitJavaProcess(Arrays.asList(new String[] {jobName}));
} else {
log.info("Heritrix not running.");
}
if (processBuilder.start().exitValue() == 0) {
if (processBuilder.start().waitFor() == 0) {
log.info("Heritrix still running, pkill'ing heritrix ");
ProcessBuilder killerProcessBuilder = new ProcessBuilder("pkill", "-f", jobName);
int pkillExitValue = killerProcessBuilder.start().exitValue();
Expand All @@ -202,6 +202,8 @@ public void stopHeritrix() {
}
} catch (IOException e) {
log.warn("Exception while trying to shutdown heritrix", e);
} catch (InterruptedException e) {
log.debug("stopHeritrix call interupted", e);
}
}

Expand Down

0 comments on commit 834eafa

Please sign in to comment.