[concurrency-interest] how to lock a ConcurrentHashMap entry

Doug Lea dl at cs.oswego.edu
Mon Sep 19 07:13:31 EDT 2005

Michele Mazzucco wrote:
> Hi all,
> is it possible to lock a single value (or a single entry <K, V>) of a 
> ConcurrentHashMap object?

No. Among other reasons, there is not necessarily a single
lock associated with each entry, and get() operations normally
run without accessing any lock at all.

These are among the tradeoffs of ConcurrentHashMap vs Hashtable.
ConcurrentHashMap gives much more scalable performance at the
price of not providing any way for users to perform external


More information about the Concurrency-interest mailing list