[concurrency-interest] Can this be done with ConcurrentHashMap ?

Brian Goetz brian@quiotix.com
Thu, 23 Dec 2004 13:19:22 -0500


Donnie Hale wrote:

 >> Assuming what I want to do is clear, is this possible with a
 >> ConcurrentHashMap?

Brian Goetz wrote:

> No.  There is no way to lock a CHM for exclusive access.  However, you 
> might be able to bootstrap the functionality you want using the atomic 
> putIfAbsent and Future, depending on your requirements.

Doug Lea wrote:

 > Usually, The best way to get the effect you want here is to create a



Tim Peierls wrote:
 >
 > Here's a general solution that uses ConcurrentHashMap that you
 > can adapt for your purposes. This is code that Joe Bowbeer wrote
 > and presented at a JavaOne talk; I don't think there are any
 > limitations on its use. (Joe, speak up if you think there might be.)


Ironically, this list has just illustrated Donnie's problem nicely.  Due 
to propagation delay, Doug, Tim, and I all looked at the list, saw no 
one had replied yet, and replied.