[concurrency-interest] ConcurrentReaderHashMap kudos!

Doug Lea dl@cs.oswego.edu
Sun, 5 Dec 2004 17:34:34 -0500

Thanks Alex for the nice example confirming that there are only two
good kinds of iterators: Fail-fast for non-thread-safe collections,
and weakly-consistent for thread-safe ones!

> > I would really like to have a ConcurrentReaderSortedMap and/or
> > ConcurrentReaderSortedSet. 
> ...
> Or, you could save yourself some trouble and download
> ConcurrentSkipListMap:
> http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166x.jar
> http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166xdocs/
> You'd have to remove the 1.5 generics stuff and compile it for 1.3.  (I
> sort of forgot this was around, but it's 1.5 so no free lunch for
> you...)

Sorry, this relies heavily on J2SE 5 (1.5) atomics support, so would
be just about impossible to back-port.

Alex might want to give these a try on a J2SE 5 pilot system, if
only to avoid investing a lot of time coming up with alternatives that
you will end up throwing away anyway when you can switch.  Like
ConcurrentHashMap, ConcurrentSkipListMap allows concurrent iterators
without any locking or throwing CCME, so ought to solve the same kinds
of problems.