hg: jdk8/tl/jdk: 8008167: IdentityHashMap.[keySet|values|entrySet].toArray speed-up

Peter Levart peter.levart at gmail.com
Sun Feb 24 15:49:29 UTC 2013


Hi Alan,

I checked and it seems all 3 IHM views [keySet|values|entrySet] have a 
fail-fast iterator implementation 
(IdentityHashMap.IdentityHashMapIterator) and all 3 are (were) using the 
iterator for .toArray implementations. So this patch tries to preserve 
the behavior when there is a concurrent modification (which is only 
possible from other thread and is illegal usage anyway since IHM is not 
thread-safe) while executing the toArray methods on the views...

Do you see something I don't see?

Regards, Peter

On 02/24/2013 03:42 PM, Peter Levart wrote:
>
> Hi Alan,
>
> I think ConcurrentModificationException could be thrown previously 
> too, if the Map was modified from other thread while iterating using 
> iterator (fail-fast iterator). Will check this in detail when I'm back 
> at screen...
>
> Regards, Peter
>
> On Feb 24, 2013 2:25 PM, "Alan Bateman" <Alan.Bateman at oracle.com 
> <mailto:Alan.Bateman at oracle.com>> wrote:
>
>     On 14/02/2013 17:55, mike.duigou at oracle.com
>     <mailto:mike.duigou at oracle.com> wrote:
>
>         Changeset: e57019d2f34a
>         Author:    mduigou
>         Date:      2013-02-13 14:50 -0800
>         URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/e57019d2f34a
>
>         8008167: IdentityHashMap.[keySet|values|entrySet].toArray speed-up
>         Reviewed-by: mduigou, martin
>         Contributed-by: Peter Levart<peter.levary at gmail.com
>         <mailto:peter.levary at gmail.com>>
>
>         ! src/share/classes/java/util/IdentityHashMap.java
>
>     A belated comment on this is that CME will now be thrown for cases
>     where it wasn't previously. We need to make sure this behavior
>     change is tracked (for release notes, etc.).
>
>     -Alan
>




More information about the core-libs-dev mailing list