java/lang/Thread/ThreadStateTest.java can fail with when checkThreadState finds an unexpected state.

Exception in thread "main" java.lang.RuntimeException: MyThread expected to have TERMINATED but got RUNNABLE
        at ThreadStateTest.checkThreadState(ThreadStateTest.java:119)
        at ThreadStateTest.main(ThreadStateTest.java:96)

There is a race between the thread being put in a specific state and the thread testing for that state. The test should retry the thread state check a number of times before failing. Also, some minor cleanup and update to use a more recent j.u.c reusable synchronization barrier.

http://cr.openjdk.java.net/~chegar/7021010/jdk8.webrev.00/webrev/

-Chris.

Reply via email to