[concurrency-interest] CopyOnWriteArrayNavigableSet too late for JEP 266?

Mike Duigou openjdk at duigou.org
Wed Oct 14 23:08:14 EDT 2015

  Doug Lea wrote:
>   So, one question is whether all four of SortedArrayList, 
> SortedArraySet,
>   SortedCopyOnWriteArrayList, and SortedCopyOnWriteArraySet should now 
> be
>   introduced to fill in the coverage gaps. Or whether the use cases
>   covered by only SortedCopyOnWriteArraySet are special enough to
>   warrant inclusion without the others. This is the kind of question
>   that tends to lead to prolonged inaction in JDK. So any thoughts on
>   resolving it quickly would be welcome.

I recall closing at least a few RFEs for these during my time as core 
collections maintainer and I largely agree that the sorted variations 
aren't essential.

COWL and COWSet both end up getting used for small to medium sized 
collections where the non-interference between mutation and iteration is 
useful--such as collections of listeners. Some also like that COWL has a 
lower synchronization overhead than using 
Collections.synchronized(List|Set) on another List or Set type. Prior to 
Java 8 the availability of the *IfAbsent without needing to worry about 
how synchronization was to be handled was also a plus.

Is NavigableCopyOnWriteArraySet useful and sufficiently different in 
performance characteristics from other already available NavigableSet 
implementations? I hope so.

>   I'm not sure about prospects for jdk9.

I will remain hopeful.  :-) I have the source as a patch against 
jdk9-dev currently. The only aspect that I know still needs attention is 
serialization but I otherwise think we can move quickly. Since the 
implementation is derived from CopyOnWriteArraySet there is no question 
of offering it under any license other than the same Public Domain 
license as the rest of the J.U.C code. Can we start the process of 
integrating it into the JSR-166 repo?


More information about the Concurrency-interest mailing list