Maybe I misunderstood Arun's idea, but it sounded to me like it added a lot of complexity. This JIRA indicates this bug exists in 0.20.1 - do we anticipate fixing it for branch-20, or only for 21? If for branch-20, I think the COWArraySet is safer, no?
Arun's idea is more complex, but it also addresses related problems. Different fixes for 0.20/0.21/0.22 may make sense. A COWArraySet probably isn't the right data structure per the preceding, but another of the concurrent collections would be fine.
What about ConcurrentSkipListSet? It's logarithmic and has weakly consistent iteration.
Sure, that'd work. Again, it's backed by a map, just as HashSet and the current patch's pseudo-ConcurrentHashSet. ConcurrentHashMap doesn't mention its contains/insertion complexity in the javadoc, but debating its superiority to log(n) seems pointless for a degenerate case of tens of thousands of elements. Since the type doesn't leak, being consistent with it doesn't make much difference, either.