int pid = getPid(); LOGGER.fine("Killing pid="+pid); UnixReflection.destroy(pid);
/** * Tries to kill this process. */ public void kill() throws InterruptedException { try { int pid = getPid(); logger.debug("Killing pid=" + pid); UnixReflection.destroyProcesses(pid); } catch (IllegalAccessException e) { // this is impossible IllegalAccessError x = new IllegalAccessError(); x.initCause(e); throw x; } catch (InvocationTargetException e) { // tunnel serious errors if (e.getTargetException() instanceof Error) { throw (Error) e.getTargetException(); } // otherwise log and let go. I need to see when this happens logger.info("Failed to terminate pid=" + getPid(), e); } killByKiller(); }
/** * Tries to kill this process. */ public void kill() throws InterruptedException { if (getVeto() != null) return; try { int pid = getPid(); LOGGER.fine("Killing pid="+pid); UnixReflection.destroy(pid); } catch (IllegalAccessException e) { // this is impossible IllegalAccessError x = new IllegalAccessError(); x.initCause(e); throw x; } catch (InvocationTargetException e) { // tunnel serious errors if(e.getTargetException() instanceof Error) throw (Error)e.getTargetException(); // otherwise log and let go. I need to see when this happens LOGGER.log(Level.INFO, "Failed to terminate pid="+getPid(),e); } killByKiller(); }
static void destroyProcesses(int pid) throws IllegalAccessException, InvocationTargetException { if (isJava8OrLater()) { DESTROY_PROCESS.invoke(null, pid, true); } else { DESTROY_PROCESS.invoke(null, pid); } }
public static void destroy(int pid) throws IllegalAccessException, InvocationTargetException { if (isPreJava8()) { DESTROY_PROCESS.invoke(null, pid); } else { DESTROY_PROCESS.invoke(null, pid, false); } }
@Override public OSProcess get(Process proc) { return get(UnixReflection.pid(proc)); }