1 /*
2 * Copyright (c) 2011, 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 7036199
27 * @summary Check that GarbageCollection notification are thrown by every GarbageCollectorMXBean
28 * @author Frederic Parain
29 * @requires vm.opt.ExplicitGCInvokesConcurrent == null | vm.opt.ExplicitGCInvokesConcurrent == false
30 * @run main/othervm GarbageCollectionNotificationTest
31 */
32
33 import java.util.*;
34 import java.lang.management.*;
35 import java.lang.reflect.*;
36 import javax.management.*;
37 import javax.management.openmbean.*;
38 import com.sun.management.GarbageCollectionNotificationInfo;
39 import com.sun.management.GcInfo;
40 import java.security.AccessController;
41 import java.security.PrivilegedAction;
42 import java.lang.reflect.Field;
43
44 public class GarbageCollectionNotificationTest {
45 private static HashMap<String,Boolean> listenerInvoked = new HashMap<String,Boolean>();
46 static volatile long count = 0;
47 static volatile long number = 0;
48 static Object synchronizer = new Object();
49
|
1 /*
2 * Copyright (c) 2011, 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 7036199
27 * @summary Check that GarbageCollection notification are thrown by every GarbageCollectorMXBean
28 * @author Frederic Parain
29 * @requires vm.opt.ExplicitGCInvokesConcurrent == null | vm.opt.ExplicitGCInvokesConcurrent == false
30 * @modules jdk.management
31 * @run main/othervm GarbageCollectionNotificationTest
32 */
33
34 import java.util.*;
35 import java.lang.management.*;
36 import java.lang.reflect.*;
37 import javax.management.*;
38 import javax.management.openmbean.*;
39 import com.sun.management.GarbageCollectionNotificationInfo;
40 import com.sun.management.GcInfo;
41 import java.security.AccessController;
42 import java.security.PrivilegedAction;
43 import java.lang.reflect.Field;
44
45 public class GarbageCollectionNotificationTest {
46 private static HashMap<String,Boolean> listenerInvoked = new HashMap<String,Boolean>();
47 static volatile long count = 0;
48 static volatile long number = 0;
49 static Object synchronizer = new Object();
50
|