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

Staffan Larsen staffan.larsen at oracle.com
Fri Oct 18 04:09:07 PDT 2013


Looks good!

Nit:  for(int i=0;i<100;i++) should have more spaces:  for (int i = 0; i < 100; i++)

Thanks,
/Staffan

On 16 okt 2013, at 16:18, Jaroslav Bachorik <jaroslav.bachorik at oracle.com> wrote:

> 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