Implementation of VMManagement interface that accesses the management attributes and operations locally within the same Java virtual machine.
| 45 | * machine. |
| 46 | */ |
| 47 | class VMManagementImpl implements VMManagement { |
| 48 | |
| 49 | private static String version; |
| 50 | |
| 51 | private static boolean compTimeMonitoringSupport; |
| 52 | private static boolean threadContentionMonitoringSupport; |
| 53 | private static boolean currentThreadCpuTimeSupport; |
| 54 | private static boolean otherThreadCpuTimeSupport; |
| 55 | private static boolean bootClassPathSupport; |
| 56 | private static boolean objectMonitorUsageSupport; |
| 57 | private static boolean synchronizerUsageSupport; |
| 58 | private static boolean threadAllocatedMemorySupport; |
| 59 | private static boolean gcNotificationSupport; |
| 60 | private static boolean remoteDiagnosticCommandsSupport; |
| 61 | |
| 62 | |
| 63 | static { // WC: native methods not allowed in JavaScript |
| 64 | version = (org.opensourcephysics.js.JSUtil.isJS)?"0":getVersion0(); |
| 65 | if (version == null) { |
| 66 | throw new AssertionError("Invalid Management Version"); |
| 67 | } |
| 68 | if(!org.opensourcephysics.js.JSUtil.isJS)initOptionalSupportFields(); |
| 69 | } |
| 70 | private native static String getVersion0(); |
| 71 | private native static void initOptionalSupportFields(); |
| 72 | |
| 73 | // Optional supports |
| 74 | public boolean isCompilationTimeMonitoringSupported() { |
| 75 | return compTimeMonitoringSupport; |
| 76 | } |
| 77 | |
| 78 | public boolean isThreadContentionMonitoringSupported() { |
| 79 | return threadContentionMonitoringSupport; |
| 80 | } |
| 81 | |
| 82 | public boolean isCurrentThreadCpuTimeSupported() { |
| 83 | return currentThreadCpuTimeSupport; |
| 84 | } |
| 85 | |
| 86 | public boolean isOtherThreadCpuTimeSupported() { |
| 87 | return otherThreadCpuTimeSupport; |
| 88 | } |
| 89 | |
| 90 | public boolean isBootClassPathSupported() { |
| 91 | return bootClassPathSupport; |
| 92 | } |
| 93 | |
| 94 | public boolean isObjectMonitorUsageSupported() { |
| 95 | return objectMonitorUsageSupport; |
| 96 | } |
| 97 | |
| 98 | public boolean isSynchronizerUsageSupported() { |
| 99 | return synchronizerUsageSupport; |
| 100 | } |
| 101 | |
| 102 | public boolean isThreadAllocatedMemorySupported() { |
| 103 | return threadAllocatedMemorySupport; |
| 104 | } |
nothing calls this directly
no test coverage detected