1 /*
2 * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 6396794
27 * @summary Check that LastGcInfo contents are reasonable
28 * @author Eamonn McManus
29 * @run main/othervm -XX:-ExplicitGCInvokesConcurrent GcInfoCompositeType
30 */
31 // Passing "-XX:-ExplicitGCInvokesConcurrent" to force System.gc()
32 // run on foreground when CMS is used and prevent situations when "GcInfo"
33 // is missing even though System.gc() was successfuly processed.
34
35 import java.util.*;
36 import java.lang.management.*;
37 import java.lang.reflect.*;
38 import javax.management.*;
39 import javax.management.openmbean.*;
40 import com.sun.management.GcInfo;
41
42 public class GcInfoCompositeType {
43 private static int tested = 0;
44
45 public static void main(String[] args) throws Exception {
46 MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
47 final ObjectName gcMXBeanPattern =
48 new ObjectName("java.lang:type=GarbageCollector,*");
|
1 /*
2 * Copyright (c) 2006, 2015 Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 6396794
27 * @summary Check that LastGcInfo contents are reasonable
28 * @author Eamonn McManus
29 * @modules java.management
30 * jdk.management
31 * @run main/othervm -XX:-ExplicitGCInvokesConcurrent GcInfoCompositeType
32 */
33 // Passing "-XX:-ExplicitGCInvokesConcurrent" to force System.gc()
34 // run on foreground when CMS is used and prevent situations when "GcInfo"
35 // is missing even though System.gc() was successfuly processed.
36
37 import java.util.*;
38 import java.lang.management.*;
39 import java.lang.reflect.*;
40 import javax.management.*;
41 import javax.management.openmbean.*;
42 import com.sun.management.GcInfo;
43
44 public class GcInfoCompositeType {
45 private static int tested = 0;
46
47 public static void main(String[] args) throws Exception {
48 MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
49 final ObjectName gcMXBeanPattern =
50 new ObjectName("java.lang:type=GarbageCollector,*");
|