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 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 * @build jdk.testlibrary.*
35 * @build ThreadStateTest ThreadStateController
36 * @run main/othervm -Xmixed ThreadStateTest
37 */
38
39 public class ThreadStateTest {
40 private static boolean testFailed = false;
41
42 // used to achieve waiting states
43 private static final Object globalLock = new Object();
44
45 public static void main(String[] argv) throws Exception {
46 // Call Thread.getState to force all initialization done
47 // before test verification begins.
48 Thread.currentThread().getState();
49 ThreadStateController thread = new ThreadStateController("StateChanger", globalLock);
50 thread.setDaemon(true);
51
52 // before myThread starts
53 thread.checkThreadState(NEW);
|
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 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);
|