src/jdk.internal.vm.compiler.management/share/classes/org.graalvm.compiler.hotspot.management/src/org/graalvm/compiler/hotspot/management/HotSpotGraalManagement.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
34 import javax.management.MalformedObjectNameException; |
34 import javax.management.MalformedObjectNameException; |
35 import javax.management.NotCompliantMBeanException; |
35 import javax.management.NotCompliantMBeanException; |
36 import javax.management.ObjectName; |
36 import javax.management.ObjectName; |
37 |
37 |
38 import org.graalvm.compiler.debug.TTY; |
38 import org.graalvm.compiler.debug.TTY; |
|
39 import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig; |
39 import org.graalvm.compiler.hotspot.HotSpotGraalManagementRegistration; |
40 import org.graalvm.compiler.hotspot.HotSpotGraalManagementRegistration; |
40 import org.graalvm.compiler.hotspot.HotSpotGraalRuntime; |
41 import org.graalvm.compiler.hotspot.HotSpotGraalRuntime; |
41 import org.graalvm.compiler.serviceprovider.ServiceProvider; |
42 import org.graalvm.compiler.serviceprovider.ServiceProvider; |
42 |
43 |
43 /** |
44 /** |
54 private HotSpotGraalRuntimeMBean bean; |
55 private HotSpotGraalRuntimeMBean bean; |
55 private volatile boolean needsRegistration = true; |
56 private volatile boolean needsRegistration = true; |
56 HotSpotGraalManagement nextDeferred; |
57 HotSpotGraalManagement nextDeferred; |
57 |
58 |
58 @Override |
59 @Override |
59 public void initialize(HotSpotGraalRuntime runtime) { |
60 public void initialize(HotSpotGraalRuntime runtime, GraalHotSpotVMConfig config) { |
60 if (bean == null) { |
61 if (bean == null) { |
61 if (runtime.getManagement() != this) { |
62 if (runtime.getManagement() != this) { |
62 throw new IllegalArgumentException("Cannot initialize a second management object for runtime " + runtime.getName()); |
63 throw new IllegalArgumentException("Cannot initialize a second management object for runtime " + runtime.getName()); |
63 } |
64 } |
64 try { |
65 try { |
154 ArrayList<MBeanServer> servers = MBeanServerFactory.findMBeanServer(null); |
155 ArrayList<MBeanServer> servers = MBeanServerFactory.findMBeanServer(null); |
155 if (!servers.isEmpty()) { |
156 if (!servers.isEmpty()) { |
156 platformMBeanServer = ManagementFactory.getPlatformMBeanServer(); |
157 platformMBeanServer = ManagementFactory.getPlatformMBeanServer(); |
157 process(); |
158 process(); |
158 } |
159 } |
159 } catch (SecurityException e) { |
160 } catch (SecurityException | UnsatisfiedLinkError | NoClassDefFoundError | UnsupportedOperationException e) { |
160 // Without permission to find or create the MBeanServer, |
161 // Without permission to find or create the MBeanServer, |
161 // we cannot process any Graal mbeans. |
162 // we cannot process any Graal mbeans. |
|
163 // Various other errors can occur in the ManagementFactory (JDK-8076557) |
162 deferred = null; |
164 deferred = null; |
163 } |
165 } |
164 } else { |
166 } else { |
165 process(); |
167 process(); |
166 } |
168 } |