6987597: ManagementFactory.getGarbageCollectorMXBeans() returns empty list with CMS
Reviewed-by: mchung
diff --git a/test/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java b/test/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java
index fe06d0a..a60ae8a 100644
--- a/test/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java
+++ b/test/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2013 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
@@ -27,8 +27,11 @@
* @summary Sanity Test for GarbageCollectorMXBean.getLastGcInfo().
* @author Mandy Chung
*
- * @run main LastGCInfo
+ * @run main/othervm -XX:-ExplicitGCInvokesConcurrent LastGCInfo
*/
+// Passing "-XX:-ExplicitGCInvokesConcurrent" to force System.gc()
+// run on foreground when CMS is used and prevent situations when "GcInfo"
+// is missing even though System.gc() was successfuly processed.
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryUsage;
diff --git a/test/java/lang/management/GarbageCollectorMXBean/GcInfoCompositeType.java b/test/java/lang/management/GarbageCollectorMXBean/GcInfoCompositeType.java
index 73488d9..0c4a480 100644
--- a/test/java/lang/management/GarbageCollectorMXBean/GcInfoCompositeType.java
+++ b/test/java/lang/management/GarbageCollectorMXBean/GcInfoCompositeType.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 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
@@ -26,8 +26,11 @@
* @bug 6396794
* @summary Check that LastGcInfo contents are reasonable
* @author Eamonn McManus
- * @run main/othervm GcInfoCompositeType
+ * @run main/othervm -XX:-ExplicitGCInvokesConcurrent GcInfoCompositeType
*/
+// Passing "-XX:-ExplicitGCInvokesConcurrent" to force System.gc()
+// run on foreground when CMS is used and prevent situations when "GcInfo"
+// is missing even though System.gc() was successfuly processed.
import java.util.*;
import java.lang.management.*;