1 /*
2 * Copyright (c) 2005, 2010, 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 /*
26 * @test
27 * @bug 5086470
28 * @summary Basic Test for the following methods:
29 * - ThreadMXBean.findDeadlockedThreads()
30 * - ThreadMXBean.findMonitorDeadlockedThreads()
31 * @author Mandy Chung
32 *
33 * @build MonitorDeadlock
34 * @build SynchronizerDeadlock
35 * @build ThreadDump
36 * @run main/othervm FindDeadlocks
37 */
38
39 import java.lang.management.*;
40 import java.util.*;
41
42 public class FindDeadlocks {
43 static ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
44 public static void main(String[] argv) {
45 ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
46 // create deadlocked threads
47 MonitorDeadlock md = new MonitorDeadlock();
48
49 // no deadlock
50 if (findDeadlocks() != null) {
51 throw new RuntimeException("TEST FAILED: Should return null.");
52 }
|
1 /*
2 * Copyright (c) 2005, 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 /*
26 * @test
27 * @bug 5086470
28 * @summary Basic Test for the following methods:
29 * - ThreadMXBean.findDeadlockedThreads()
30 * - ThreadMXBean.findMonitorDeadlockedThreads()
31 * @author Mandy Chung
32 *
33 * @modules java.management
34 * @build MonitorDeadlock
35 * @build SynchronizerDeadlock
36 * @build ThreadDump
37 * @run main/othervm FindDeadlocks
38 */
39
40 import java.lang.management.*;
41 import java.util.*;
42
43 public class FindDeadlocks {
44 static ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
45 public static void main(String[] argv) {
46 ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
47 // create deadlocked threads
48 MonitorDeadlock md = new MonitorDeadlock();
49
50 // no deadlock
51 if (findDeadlocks() != null) {
52 throw new RuntimeException("TEST FAILED: Should return null.");
53 }
|