Review request for 8022208: Intermittent test failures in java/lang/Thread/ThreadStateTest.java

Martin Buchholz martinrb at google.com
Thu Oct 31 11:01:11 PDT 2013


+                iterations++;

Using ++ on a volatile int looks racy.  Using an AtomicInteger is strictly
more reliable.


On Thu, Oct 31, 2013 at 10:53 AM, Mandy Chung <mandy.chung at oracle.com>wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20131031/8fdc8116/attachment.html 


More information about the serviceability-dev mailing list