1 /*
2 * Copyright (c) 2003, 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 4530538
27 * @summary Basic unit test of ThreadInfo.getBlockedCount()
28 * @author Alexei Guibadoulline and Mandy Chung
29 * @author Jaroslav Bachorik
30 * @run main ThreadBlockedCount
31 */
32
33 import java.lang.management.*;
34 import java.util.concurrent.Phaser;
35
36 public class ThreadBlockedCount {
37 final static long EXPECTED_BLOCKED_COUNT = 3;
38 final static int DEPTH = 10;
39 private static final ThreadMXBean mbean
40 = ManagementFactory.getThreadMXBean();
41
42 private static final Object a = new Object();
43 private static final Object b = new Object();
44 private static final Object c = new Object();
45
46 private static final Object blockedObj1 = new Object();
47 private static final Object blockedObj2 = new Object();
48 private static final Object blockedObj3 = new Object();
49 private static volatile boolean testOk = true;
|
1 /*
2 * Copyright (c) 2003, 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 4530538
27 * @summary Basic unit test of ThreadInfo.getBlockedCount()
28 * @author Alexei Guibadoulline and Mandy Chung
29 * @author Jaroslav Bachorik
30 * @modules java.management
31 * @run main ThreadBlockedCount
32 */
33
34 import java.lang.management.*;
35 import java.util.concurrent.Phaser;
36
37 public class ThreadBlockedCount {
38 final static long EXPECTED_BLOCKED_COUNT = 3;
39 final static int DEPTH = 10;
40 private static final ThreadMXBean mbean
41 = ManagementFactory.getThreadMXBean();
42
43 private static final Object a = new Object();
44 private static final Object b = new Object();
45 private static final Object c = new Object();
46
47 private static final Object blockedObj1 = new Object();
48 private static final Object blockedObj2 = new Object();
49 private static final Object blockedObj3 = new Object();
50 private static volatile boolean testOk = true;
|