Skip to content

Commit

Permalink
Clearer logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jglick committed Feb 19, 2025
1 parent 7a70750 commit fb6d341
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import hudson.AbortException;
import hudson.EnvVars;
import hudson.Extension;
import hudson.Functions;
import hudson.Util;
import hudson.model.Descriptor;
import hudson.model.Slave;
Expand Down Expand Up @@ -88,15 +87,18 @@ public void launch(SlaveComputer computer, final TaskListener listener) {
}

@Override
public void afterDisconnect(SlaveComputer computer, TaskListener listener) {
public synchronized void afterDisconnect(SlaveComputer computer, TaskListener listener) {
if (proc != null) {
try {
ProcessTree.get().killAll(proc, cookie);
LOGGER.info(() -> "killed " + proc + " with " + cookie + " for " + computer.getName());
} catch (Exception x) {
Functions.printStackTrace(x, listener.error("Failed to terminate process"));
LOGGER.log(Level.WARNING, "failed to kill " + proc + " with " + cookie + " for " + computer.getName(), x);
}
proc = null;
cookie = null;
} else {
LOGGER.info(() -> "no process for " + computer.getName());
}
}

Expand Down

0 comments on commit fb6d341

Please sign in to comment.