Exclude JDK 11 jps process. close #451

This commit is contained in:
hengyunabc 2019-01-18 16:39:08 +08:00
parent 4b98af05a9
commit 5c857d045a

View File

@ -121,7 +121,7 @@ public class ProcessUtils {
if (pid == currentPid) {
continue;
}
if (strings.length >= 2 && strings[1].equals("sun.tools.jps.Jps")) { // skip jps
if (strings.length >= 2 && isJspProcess(strings[1])) { // skip jps
continue;
}
@ -380,4 +380,7 @@ public class ProcessUtils {
return jpsList.get(0);
}
private static boolean isJspProcess(String mainClassName) {
return "sun.tools.jps.Jps".equals(mainClassName) || "jdk.jcmd/sun.tools.jps.Jps".equals(mainClassName);
}
}