[concurrency-interest] ConcurrentHashMapV8

davidcholmes at aapt.net.au davidcholmes at aapt.net.au
Thu Oct 6 01:15:01 EDT 2011

Quoting "David M. Lloyd" <david.lloyd at redhat.com>:
> In any case, I think you can say that "during iteration" is equal to
> the time in which you have any active references to the items returned
> by the iterator, because no other definition makes sense.

On the contrary, "during the iteration" means to me that the iterator  
is still active and has not yet reached the end of the collection.  
Once we reach the end the iteration is over, and so an array created  
by iteration contains invalid map.entry objects the instant the  
filling of the array completes.

Though what exactly it means to have an "invalid" map.entry object is  
itself undefined.

The spec for entrySet is poorly written and the interaction with  
toArray is not clearly defined. Given that we can argue this either way.

But because we can argue it either way I'm inclined to say leave the  
existing code as-is. Neither the existing code nor the new CHMV8 code  
is "wrong" per-se.

David Holmes

> So if
> toArray() is defined in terms of iteration then there is no conflict -
> using the array is the same as using the values returned by the
> iterator as they are returned; the iteration is seen to be in progress
> until the last entry is "discarded".  I don't see anything in the docs
> that contradict this.
> -- 
> - DML
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest

More information about the Concurrency-interest mailing list