[concurrency-interest] Bug in CustomConcurrentHashMap.KeySet.intern()

Doug Lea dl at cs.oswego.edu
Tue Jun 30 11:08:40 EDT 2009


Manuel Dominguez Sarmiento wrote:
> Hi,
> 
> I found that CustomConcurrentHashMap.KeySet.intern() was the perfect fit 
> for the object interning need we're having with a current project. 

> However, doPut() returns null when a key is first added to the map. It 
> could be easily fixed as follows:
> 
>        public K intern(K e) {
>            K oldElement = cchm.doPut(e, e, true);
>            return (oldElement != null) ? oldElement : e;
>        }

Thanks! Fixed.

> 
> BTW, how stable is this preview release for production use? Any caveats?

Not at all stable. The version there was checked in to
allow discussion about how to support various cache-like
uses (which is among the main reasons for people to use it.)
Which led to some explorations on my part on
how to efficiently support customized eviction policies
Which has in turn led to various diversions on concurrent
(and non-concurrent) hashing that further stall getting
this in releasable form.

The Map functionality has been well-tested, but as you saw, the
auxiliary functionality hasn't.

(While I'm at it: I will be away tomorrow (July 1) through
July 14 so might not respond to mail promptly.)

-Doug


More information about the Concurrency-interest mailing list