[concurrency-interest] CopyOnWrite for Maps and other lists (not just ArrayList)
morganconrad at yahoo.com
Wed Dec 8 16:05:06 EST 2010
BTW, thanks everybody for the feedback!
--- On Wed, 12/8/10, Kasper Nielsen <kasper at kav.dk> wrote:
> > My goals were decent speed, not ultimate speed.
> May I ask you what use case you are trying to solve. I fail
> to see what
> kind of benefits your implementation provides over either
> ConcurrentSkipListMap, ConcurrentHashMap or
We were working with old code written somewhere else and *way* before java.util.concurrent. Instead of rewriting a lot of code to use (or subclass) ConcurrentSkipListMap, I thought a wrapper would be easier. Also, I was very familiar with CopyOnWriteArrayList, and our maps fit the "write seldom, iterate often" model. Since most of the issues showed up as ConcurrentModificationExceptions, part of the effort was really debugging/testing to verify where they were coming from. In some ways, these classes are a "let's try this, if it fixes the CME we know the issue, and hopefully performance is still adequate".
I'm less familiar with Concurrent maps. I definitely did not want to be locked during iteration, because in our code that can be time consuming and affects the GUI.
More information about the Concurrency-interest