https://bugs.openjdk.java.net/browse/JDK-8022208
Webrev at:
http://cr.openjdk.java.net/~mchung/jdk8/webrevs/8022208/webrev.00/
The retry loop in checking the thread state assumes that the thread
state is in RUNNABLE state which isn't always the case (it could be any
other state). The fix is to remove that check and the thread should be
a daemon thread so that the test can terminate if any exception is thrown.
jdk/test/java/lang/management/ThreadMXBean/ThreadStateTest.java is a
similar test that performs additional validation on the ThreadMXBean
API. It should also be fixed as a daemon thread I take the opportunity
to change it to use java.util.concurrent.Phaser instead of the utility
class.
Mandy