Review Request: JDK-8173947: jconsole does not show local running VMs to attach
Mandy Chung
mandy.chung at oracle.com
Mon Feb 6 00:29:06 UTC 2017
sun.management.ConnectorAddressLink is renamed to jdk.internal.agent.ConnectorAddressLink but missed the Class.forName call in JConsole. Thanks to Peter catching this regression. Since jdk.jconsole requires jdk.attach and jdk.management.agent that guarantees the classes required are present at runtime, so we can drop the Class.forName calls.
I leave the isLocalAttachAvailable() method there to keep the current implementation that supports to run even if the local attach is not supported.
Mandy
diff --git a/src/jdk.jconsole/share/classes/sun/tools/jconsole/JConsole.java b/src/jdk.jconsole/share/classes/sun/tools/jconsole/JConsole.java
--- a/src/jdk.jconsole/share/classes/sun/tools/jconsole/JConsole.java
+++ b/src/jdk.jconsole/share/classes/sun/tools/jconsole/JConsole.java
@@ -949,23 +949,12 @@
}
}
- private static final boolean localAttachmentSupported;
- static {
- boolean supported;
- try {
- Class.forName("com.sun.tools.attach.VirtualMachine");
- Class.forName("sun.management.ConnectorAddressLink");
- supported = true;
- } catch (NoClassDefFoundError x) {
- supported = false;
- } catch (ClassNotFoundException x) {
- supported = false;
- }
- localAttachmentSupported = supported;
- }
-
+ /**
+ * local attach is supported in this implementation as jdk.jconsole
+ * requires jdk.attach and jdk.management.agent
+ */
public static boolean isLocalAttachAvailable() {
- return localAttachmentSupported;
+ return true;
}
More information about the serviceability-dev
mailing list