[concurrency-interest] ConcurrentHashMapV8

Bob Lee crazybob at crazybob.org
Mon Aug 29 13:52:33 EDT 2011


On Mon, Aug 29, 2011 at 10:37 AM, Doug Lea <dl at cs.oswego.edu> wrote:

> It wasn't obvious to me how recursive computations are handled for the same
>> key and appears to livelock. This is an error condition that used to
>> deadlocked MapMaker. I fixed this by failing fast if Thread.holdsLock()
>> was
>> true prior to waiting for the computation to finish.
>>
>
> I'm not sure I follow. If the user function in turn calls computeIfAbsent
> for the same key, then it seems irreparably broken in the same sense as,
> for example. a user's equals() function that attempts to invoke map.put.


It is irreparably broken, but it's an easy and common mistake to make. It's
difficult to identify the problem when the program just deadlocks vs.
throwing an explicit exception that identifies the at fault key.

Bob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20110829/30d4020c/attachment.html>


More information about the Concurrency-interest mailing list