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 static final long EXPECTED_BLOCKED_COUNT = 3;
39 static final 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;
|
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 *
31 * @run main ThreadBlockedCount
32 */
33
34 import java.lang.management.*;
35 import java.util.concurrent.Phaser;
36
37 public class ThreadBlockedCount {
38 static final long EXPECTED_BLOCKED_COUNT = 3;
39 static final 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;
|