RFR 6309226: TEST: java/lang/management/ThreadMXBean/SynchronizationStatistics.java didn't check Thread.sleep
jaroslav.bachorik at oracle.com
Mon Nov 18 01:59:17 PST 2013
after discussing this with Mandy I've rewritten the test to use the
j.u.concurrent for synchronization - this also makes it much easier to
follow the test logic.
The waited time, the blocked time and the waited counts are only checked
for sanity (increasing values) since it is not possible to do the
reliable checks against hard numbers.
I ran the test in a tight loop for 1500 times using -Xcomp and -Xint and
the test seems to pass constantly.
New webrev: http://cr.openjdk.java.net/~jbachorik/6309226/webrev.03
On 21.10.2013 13:55, Jaroslav Bachorik wrote:
> Please, review this small patch for a test failing due to the updated
> implementation in JDK6.
> Issue: https://bugs.openjdk.java.net/browse/JDK-6309226
> Webrev: http://cr.openjdk.java.net/~jbachorik/6309226/webrev.00/
> The test fails due to the change in mustang where
> ThreadMXBean.getThreadInfo().getWaitedTime() and
> ThreadMXBean.getThreadInfo().getWaitedCount() include Thread.sleep()
> too. Unfortunately, Thread.sleep() is used throughout the test for
> synchronization purposes and this breaks the test.
> In the patch I propose to replace Thread.sleep() with busy wait and
> hinting the scheduler by Thread.yield(). While not very elegant it
> successfully works around inclusion of unknown number of Thread.sleep()s
> (they are called in loop).
More information about the serviceability-dev