提交 95917370 编写于 作者: P Peter Liljenberg

Ugly hack to fix destroyProcess for Java8

上级 0a05c6b8
......@@ -549,11 +549,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
try {
int pid = getPid();
LOGGER.fine("Killing pid="+pid);
if (UnixReflection.isJava8()) {
UnixReflection.DESTROY_PROCESS.invoke(null, pid, false);
} else {
UnixReflection.DESTROY_PROCESS.invoke(null, pid);
}
UnixReflection.destroy(pid);
} catch (IllegalAccessException e) {
// this is impossible
IllegalAccessError x = new IllegalAccessError();
......@@ -628,7 +624,16 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
throw x;
}
}
public static boolean isJava8() {
public static void destroy(int pid) throws IllegalAccessException, InvocationTargetException {
if (isJava8()) {
DESTROY_PROCESS.invoke(null, pid, false);
} else {
DESTROY_PROCESS.invoke(null, pid);
}
}
private static boolean isJava8() {
return (System.getProperty("java.version").startsWith("1.8"));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册