8078144: many nightly tests failed due to NoSuchMethodError: sun.management.ManagementFactoryHelper.getDiagnosticMXBean
authorsjiang
Tue, 21 Apr 2015 10:23:13 +0200
changeset 30254 224dcf3ebade
parent 30253 b82dccab7b1d
child 30280 b9efc9156778
child 30281 b1608535e50f
8078144: many nightly tests failed due to NoSuchMethodError: sun.management.ManagementFactoryHelper.getDiagnosticMXBean Reviewed-by: alanb, sla
hotspot/test/gc/g1/TestGreyReclaimedHumongousObjects.java
hotspot/test/testlibrary_tests/whitebox/vm_flags/VmFlagTest.java
--- a/hotspot/test/gc/g1/TestGreyReclaimedHumongousObjects.java	Mon Apr 20 22:07:09 2015 -0400
+++ b/hotspot/test/gc/g1/TestGreyReclaimedHumongousObjects.java	Tue Apr 21 10:23:13 2015 +0200
@@ -82,9 +82,8 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
-import sun.management.ManagementFactoryHelper;
 import com.sun.management.HotSpotDiagnosticMXBean;
-import com.sun.management.VMOption;
+import java.lang.management.ManagementFactory;
 
 public class TestGreyReclaimedHumongousObjects {
 
@@ -130,7 +129,8 @@
     }
 
     public static void main(String[] args) throws Exception {
-        HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();
+        HotSpotDiagnosticMXBean diagnostic =
+                ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
 
         System.out.println("Max memory= " + MAX_MEMORY + " bytes");
 
@@ -173,4 +173,3 @@
     private static final int THREAD_COUNT = 12;
     private static final String THREAD_NAME = "TestGreyRH-";
 }
-
--- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/VmFlagTest.java	Mon Apr 20 22:07:09 2015 -0400
+++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/VmFlagTest.java	Tue Apr 21 10:23:13 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,13 +21,13 @@
  * questions.
  */
 
-import java.util.Objects;
 import java.util.function.BiConsumer;
 import java.util.function.Function;
 import sun.hotspot.WhiteBox;
 import sun.management.*;
 import com.sun.management.*;
 import com.oracle.java.testlibrary.*;
+import java.lang.management.ManagementFactory;
 
 public final class VmFlagTest<T> {
     public static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
@@ -96,7 +96,7 @@
           return asString(getValue());
         }
         HotSpotDiagnosticMXBean diagnostic
-                = ManagementFactoryHelper.getDiagnosticMXBean();
+                = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
         VMOption tmp;
         try {
             tmp = diagnostic.getVMOption(flagName);