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 import static java.lang.Thread.State.*;
25
26 /*
27 * @test
28 * @bug 5014783 8022208
29 * @summary Basic unit test of thread states returned by
30 * Thread.getState().
31 *
32 * @author Mandy Chung
33 * @library /lib/testlibrary
34 * @library /test/lib
35 * @build jdk.testlibrary.*
36 * @build ThreadStateTest ThreadStateController
37 * @run main/othervm -Xmixed ThreadStateTest
38 */
39
40 public class ThreadStateTest {
41 private static boolean testFailed = false;
42
43 // used to achieve waiting states
44 private static final Object globalLock = new Object();
45
46 public static void main(String[] argv) throws Exception {
47 // Call Thread.getState to force all initialization done
48 // before test verification begins.
49 Thread.currentThread().getState();
50 ThreadStateController thread = new ThreadStateController("StateChanger", globalLock);
51 thread.setDaemon(true);
52
53 // before myThread starts
54 thread.checkThreadState(NEW);
55
|
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 import static java.lang.Thread.State.*;
25
26 /*
27 * @test
28 * @bug 5014783 8022208
29 * @summary Basic unit test of thread states returned by
30 * Thread.getState().
31 *
32 * @author Mandy Chung
33 * @library /lib/testlibrary
34 * @library /test/lib
35 * @build jdk.testlibrary.*
36 * @build jdk.test.lib.LockFreeLogger
37 * @build ThreadStateTest ThreadStateController
38 * @run main/othervm -Xmixed ThreadStateTest
39 */
40
41 public class ThreadStateTest {
42 private static boolean testFailed = false;
43
44 // used to achieve waiting states
45 private static final Object globalLock = new Object();
46
47 public static void main(String[] argv) throws Exception {
48 // Call Thread.getState to force all initialization done
49 // before test verification begins.
50 Thread.currentThread().getState();
51 ThreadStateController thread = new ThreadStateController("StateChanger", globalLock);
52 thread.setDaemon(true);
53
54 // before myThread starts
55 thread.checkThreadState(NEW);
56
|