RFR 8024405: Spliterators.spliterator should support CONCURRENT characteristic

Martin Buchholz martinrb at google.com
Mon Sep 16 20:46:13 UTC 2013


On Mon, Sep 16, 2013 at 12:13 PM, Paul Sandoz <paul.sandoz at oracle.com>wrote:

> >
> > I think the docs for SIZED can make it clearer that it is an error for
> the size to change while the spliterator is in progress.  One can imagine
> CONCURRENT data structures whose SIZE does not change.  An iterator over an
> AtomicReferenceArray comes to mind.
>
> I presume each element is an instance of AtomicReference? so elements of
> the array are not concurrently replaced but the values held by the ARs, and
> the iterator would need to report a ConcurrentModificationException if
> structural interference is detected? under such circumstances it might be
> OK for a spliterator of such a data structure to report SIZED/SUBSIZED.
>

 AtomicReferenceArray is an array of T, with elements atomically updated.
 You could argue there is never any "structural" modification, just like an
array of final AtomicReference ... which might qualify for IMMUTABLE.

Anyways, no matter what simple rules you come up with, someone will have a
data structure where it won't quite fit in.



More information about the core-libs-dev mailing list