RFR 7197919: java/lang/management/ThreadMXBean/ThreadBlockedCount.java has concurency issues

Jaroslav Bachorik jaroslav.bachorik at oracle.com
Wed Oct 16 07:18:39 PDT 2013


Please, review this simple test change.

The test tries to get the number of times a certain thread was blocked 
during the test run and intermittently fails with the difference of 1 - 
the expected number is 4 but the reported number is 3.

When updating the thread statistics (the blocked count in this case) no 
lock is used so there might be stale data when the ThreadMXBean 
retrieves the stats. The patch tries to workaround this problem by 
retrying a few times with the added delay. The test will try to obtain 
the correct result for at most 10 seconds - after that it will fail if 
the retrieved blocked count does not equal the expected blocked count.

Issue : https://bugs.openjdk.java.net/browse/JDK-7197919
Webrev: http://cr.openjdk.java.net/~jbachorik/7197919/webrev.00

Thanks,

-JB-


More information about the serviceability-dev mailing list