[concurrency-interest] Problem with using an unbounded map of Mutex lock objects

Brian Goetz brian at quiotix.com
Fri Jun 2 17:52:06 EDT 2006

> I am thinking perhaps a pool of locks but I need to work out how to 
> safely reuse the pool. Something close to the Pool discussed in Section 
> is probably what I need.

Look at lock striping (JCiP 11.4.3), which is also used by 
ConcurrentHashMap.  It creates an array of locks (say, 16), and uses 
hashCode() % 16 to partition the keys across the set of locks.

More information about the Concurrency-interest mailing list