8078144: many nightly tests failed due to NoSuchMethodError: sun.management.ManagementFactoryHelper.getDiagnosticMXBean

Reviewed-by: alanb, sla
This commit is contained in:
Shanliang Jiang 2015-04-21 10:23:13 +02:00
parent dba5d6fdc5
commit 137a04308f
2 changed files with 6 additions and 7 deletions

View File

@ -82,9 +82,8 @@ import java.util.concurrent.ExecutorService;
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 class TestGreyReclaimedHumongousObjects {
}
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 @@ public class TestGreyReclaimedHumongousObjects {
private static final int THREAD_COUNT = 12;
private static final String THREAD_NAME = "TestGreyRH-";
}

View File

@ -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 @@ public final class VmFlagTest<T> {
return asString(getValue());
}
HotSpotDiagnosticMXBean diagnostic
= ManagementFactoryHelper.getDiagnosticMXBean();
= ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
VMOption tmp;
try {
tmp = diagnostic.getVMOption(flagName);