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

Jason Mehrens jason_mehrens at hotmail.com
Mon Oct 19 11:38:27 EDT 2015

Hi Mike,

What are your thoughts on creating wrappers to implement the copy on write behavior (Collections.copyOnWriteXXX(Supplier))?  I always had a bias toward CopyOnWriteTreeSet instead of NavigableCopyOnWriteArraySet as a name.


From: concurrency-interest-bounces at cs.oswego.edu <concurrency-interest-bounces at cs.oswego.edu> on behalf of Mike Duigou <openjdk at duigou.org>
Sent: Wednesday, October 14, 2015 10:08 PM
To: Concurrency Interest
Subject: Re: [concurrency-interest] CopyOnWriteArrayNavigableSet too late for JEP 266?

  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?

Concurrency-interest mailing list
Concurrency-interest at cs.oswego.edu

More information about the Concurrency-interest mailing list