@Override public void killAll(Map<String, String> modelEnvVars) throws InterruptedException { for( OSProcess p : this) { if(p.getPid()<10) continue; // ignore system processes like "idle process" LOGGER.log(FINEST, "Considering to kill {0}", p.getPid()); boolean matched; try { matched = hasMatchingEnvVars(p, modelEnvVars); } catch (WindowsOSProcessException e) { // likely a missing privilege // TODO: not a minor issue - causes process termination error in JENKINS-30782 if (LOGGER.isLoggable(FINEST)) { LOGGER.log(FINEST, "Failed to check environment variable match for process with pid=" + p.getPid() ,e); } continue; } if(matched) { p.killRecursively(); } else { LOGGER.log(Level.FINEST, "Environment variable didn't match for process with pid={0}", p.getPid()); } } }
/** * Convenience method that does {@link #killAll(Map)} and {@link OSProcess#killRecursively()}. * This is necessary to reliably kill the process and its descendants, as some OS * may not implement {@link #killAll(Map)}. * * Either of the parameter can be null. */ public void killAll(Process proc, Map<String, String> modelEnvVars) throws InterruptedException { LOGGER.fine("killAll: process="+proc+" and envs="+modelEnvVars); OSProcess p = get(proc); if(p!=null) p.killRecursively(); if(modelEnvVars!=null) killAll(modelEnvVars); }
private void killRecursively(long deadline) throws InterruptedException { // We kill individual processes of a tree, so handling vetoes inside #kill() is enough for UnixProcess es LOGGER.fine("Recursively killing pid="+getPid()); for (OSProcess p : getChildren()) { if (p instanceof UnixProcess) { ((UnixProcess)p).killRecursively(deadline); } else { p.killRecursively(); // should not happen, fallback to non-deadline version } } kill(deadline); }
/** * Convenience method that does {@link #killAll(Map)} and * {@link OSProcess#killRecursively()}. This is necessary to reliably kill * the process and its descendants, as some OS may not implement * {@link #killAll(Map)}. * * Either of the parameter can be null. */ public void killAll(Process proc, Map<String, String> modelEnvVars) throws InterruptedException { logger.info("killAll (process started by build): process=" + proc + " and envs=" + modelEnvVars); OSProcess p = get(proc); if (p != null) { p.killRecursively(); } if (modelEnvVars != null) { killAll(modelEnvVars); } }
/** * Convenience method that does {@link #killAll(Map)} and {@link OSProcess#killRecursively()}. * This is necessary to reliably kill the process and its descendants, as some OS * may not implement {@link #killAll(Map)}. * * Either of the parameter can be null. */ public void killAll(Process proc, Map<String, String> modelEnvVars) throws InterruptedException { logger.info("killAll (process started by build): process=" + proc + " and envs=" + modelEnvVars); OSProcess p = get(proc); if(p!=null) p.killRecursively(); if(modelEnvVars!=null) killAll(modelEnvVars); }
/** * Convenience method that does {@link #killAll(Map)} and {@link OSProcess#killRecursively()}. * This is necessary to reliably kill the process and its descendants, as some OS * may not implement {@link #killAll(Map)}. * * Either of the parameter can be null. */ public void killAll(Process proc, Map<String, String> modelEnvVars) throws InterruptedException { LOGGER.fine("killAll: process="+proc+" and envs="+modelEnvVars); OSProcess p = get(proc); if(p!=null) p.killRecursively(); if(modelEnvVars!=null) killAll(modelEnvVars); }
/** * Convenience method that does {@link #killAll(Map)} and {@link OSProcess#killRecursively()}. * This is necessary to reliably kill the process and its descendants, as some OS * may not implement {@link #killAll(Map)}. * * Either of the parameter can be null. */ public void killAll(Process proc, Map<String, String> modelEnvVars) throws InterruptedException { LOGGER.fine("killAll: process="+proc+" and envs="+modelEnvVars); OSProcess p = get(proc); if(p!=null) p.killRecursively(); if(modelEnvVars!=null) killAll(modelEnvVars); }
/** * Convenience method that does {@link #killAll(Map)} and {@link OSProcess#killRecursively()}. * This is necessary to reliably kill the process and its descendants, as some OS * may not implement {@link #killAll(Map)}. * * Either of the parameter can be null. */ public void killAll(Process proc, Map<String, String> modelEnvVars) throws InterruptedException { LOGGER.fine("killAll: process="+proc+" and envs="+modelEnvVars); OSProcess p = get(proc); if(p!=null) p.killRecursively(); if(modelEnvVars!=null) killAll(modelEnvVars); }
public void killAll(Map<String, String> modelEnvVars) throws InterruptedException { for (OSProcess p : this) if(p.hasMatchingEnvVars(modelEnvVars)) p.killRecursively(); } }
public void killAll(Map<String, String> modelEnvVars) throws InterruptedException { for (OSProcess p : this) if(p.hasMatchingEnvVars(modelEnvVars)) p.killRecursively(); } }
public void killAll(Map<String, String> modelEnvVars) throws InterruptedException { for (OSProcess p : this) if(p.hasMatchingEnvVars(modelEnvVars)) p.killRecursively(); } }
public void killRecursively() throws InterruptedException { LOGGER.fine("Recursively killing pid="+getPid()); for (OSProcess p : getChildren()) p.killRecursively(); kill(); }
public void killAll(Map<String, String> modelEnvVars) throws InterruptedException { for (OSProcess p : this) { if (p.hasMatchingEnvVars(modelEnvVars)) { p.killRecursively(); } } } }
public void killRecursively() throws InterruptedException { logger.debug("Recursively killing pid=" + getPid()); for (OSProcess p : getChildren()) { p.killRecursively(); } kill(); }
public void killAll(Map<String, String> modelEnvVars) throws InterruptedException { for (OSProcess p : this) if(p.hasMatchingEnvVars(modelEnvVars)) p.killRecursively(); } }
public void killRecursively() throws InterruptedException { logger.debug("Recursively killing pid="+getPid()); for (OSProcess p : getChildren()) p.killRecursively(); kill(); }
public void killRecursively() throws InterruptedException { LOGGER.fine("Recursively killing pid="+getPid()); for (OSProcess p : getChildren()) p.killRecursively(); kill(); }
public void killRecursively() throws InterruptedException { // We kill individual processes of a tree, so handling vetoes inside #kill() is enough for UnixProcess es LOGGER.fine("Recursively killing pid="+getPid()); for (OSProcess p : getChildren()) p.killRecursively(); kill(); }
ProcessTree pt = ProcessTree.get(); if(proc!=null) pt.get(proc).killRecursively(); if(modelEnvVars!=null) pt.killAll(modelEnvVars);
public void killAll(Map<String, String> modelEnvVars) throws InterruptedException { for (OSProcess p : this) if(p.hasMatchingEnvVars(modelEnvVars)) p.killRecursively(); } }