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

Manuel Dominguez Sarmiento mads at renxo.com
Tue Jun 30 12:37:20 EDT 2009


Hi David,

Thanks for the info. Is the implementation of the new 
CustomConcurrentHashMap basically the same as ConcurrentReferenceHashMap 
or does it contain any significant design differences? On the surface 
they look pretty similar but I'm not so sure about the internals.

Ing. Manuel Dominguez Sarmiento
Director General
Renxo S.A.
e-mail:	mads at renxo.com
Phone:	+54 11 4719 6806, ext. 104



David M. Lloyd wrote:
> I can reply to that - yes, I use ConcurrentReferenceHashMap in several 
> projects including the new JBoss Remoting, and it is also in use in a 
> few other places in JBoss code.  My own testing demonstrates that it's 
> quite stable for the uses to which I have put it, but there's 
> certainly no warranty of any kind attached to it (as per the various 
> license agreements).
>
> That said, once there's an accepted standard implementation for this 
> purpose, chances are good that I'll switch to it at that time unless 
> there's a compelling reason not to; I'm using it mainly because I 
> needed an immediate solution, and that's what was available (and that 
> it was developed in large part by a coworker of mine (Jason T. Greene, 
> also on this list), so I can hassle him directly with questions).
>
> - DML
>
> On 06/30/2009 10:16 AM, Manuel Dominguez Sarmiento wrote:
>> Hi Doug,
>>
>> Thanks for the update. I noticed that several projects are using some 
>> form or another of ConcurrentReferenceHashMap, which I believe is the 
>> precursor to CustomConcurrentHashMap (for instance, JBoss Remoting as 
>> well as a few others are using these on their releases). Are these 
>> versions any more stable? If so, were can I find the latest source (I 
>> can only find CustomConcurrentHashMap in CVS).
>>
>> Thanks!
>>
>> Ing. Manuel Dominguez Sarmiento
>> Director General
>> Renxo S.A.
>> e-mail:    mads at renxo.com
>> Phone:    +54 11 4719 6806, ext. 104
>>
>>
>>
>> Doug Lea wrote:
>>> 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
>>
>> _______________________________________________
>> Concurrency-interest mailing list
>> Concurrency-interest at cs.oswego.edu
>> http://cs.oswego.edu/mailman/listinfo/concurrency-interest



More information about the Concurrency-interest mailing list