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

Mandy Chung mandy.chung at oracle.com
Thu Oct 31 11:22:43 PDT 2013


On 10/31/2013 11:01 AM, Martin Buchholz wrote:
> +                iterations++;
>
> Using ++ on a volatile int looks racy.  Using an AtomicInteger is 
> strictly more reliable.
>

Oh that's right.  Will fix that.  I don't really like duplicating the 
code in these 2 tests and I am going to refactor it and add the shared 
code in the testlibrary.    Will send out a revised webrev.

Mandy

>
> On Thu, Oct 31, 2013 at 10:53 AM, Mandy Chung <mandy.chung at oracle.com 
> <mailto: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/
>     <http://cr.openjdk.java.net/%7Emchung/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/d20acef6/attachment.html 


More information about the serviceability-dev mailing list