hotspot/test/serviceability/threads/TestFalseDeadLock.java
changeset 27453 9aeb9b97bef6
parent 18085 fb6d02a9e1c5
child 27480 51e6396f8a98
equal deleted inserted replaced
27452:b1fef8d1658d 27453:9aeb9b97bef6
     1 /*
     1 /*
     2  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    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
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
       
    24 import com.oracle.java.testlibrary.Utils;
    24 import java.lang.management.ManagementFactory;
    25 import java.lang.management.ManagementFactory;
    25 import java.lang.management.ThreadMXBean;
    26 import java.lang.management.ThreadMXBean;
    26 import java.util.Random;
    27 import java.util.Random;
    27 
    28 
    28 /*
    29 /*
    29  * @test
    30  * @test
    30  * @bug 8016304
    31  * @bug 8016304
    31  * @summary Make sure no deadlock is reported for this program which has no deadlocks.
    32  * @summary Make sure no deadlock is reported for this program which has no deadlocks.
       
    33  * @library /testlibrary
    32  * @run main/othervm TestFalseDeadLock
    34  * @run main/othervm TestFalseDeadLock
    33  */
    35  */
    34 
    36 
    35 /*
    37 /*
    36  * This test will not provoke the bug every time it is run since the bug is intermittent.
    38  * This test will not provoke the bug every time it is run since the bug is intermittent.
    63         }
    65         }
    64     }
    66     }
    65 
    67 
    66     public static class Test implements Runnable {
    68     public static class Test implements Runnable {
    67         public void run() {
    69         public void run() {
    68             Random r = new Random();
    70             Random r = Utils.getRandomInstance();
    69             while (running) {
    71             while (running) {
    70                 try {
    72                 try {
    71                     synchronized (this) {
    73                     synchronized (this) {
    72                         wait(r.nextInt(1000) + 1);
    74                         wait(r.nextInt(1000) + 1);
    73                     }
    75                     }