jmx-dev JDK-7120365 DiffHBTest.java fails due to ConcurrentModificationException
Alan Bateman
Alan.Bateman at oracle.com
Mon Dec 24 08:06:41 PST 2012
On 24/12/2012 14:08, shanliang wrote:
> webrev: http://cr.openjdk.java.net/~sjiang/JDK-7120365/webrev.00/
>
> The test is correct, it was implemented to verify the fix for bug
> 4911721, but in addition it detects luckily another problem within the
> method ServerNotifForwarder.snoopOnUnregister
>
> The problem was that during a "for" cycle, the set list was modified
> by anther thread, the solution is to use a unmodifiable set.
>
> This fix is important, it not only re-enables a test, but also fixes a
> concurrent modification bug in the jmx notification.
>
> Shanliang
Are you sure this is right? I don't know this code but from a brief
glance then it appears to me that all access to listenerMap requires
first synchronizes on it and maybe you need to do this and then take a
copy (not a unmodifiable view) of the delegate set before you iterate
over it. Apologies if you looked at this in detail, it's just not clear
to me how using an unmodifiable view fixes the problem if the issue is
actually that other threads are modifying the set.
-Alan
More information about the serviceability-dev
mailing list