[concurrency-interest] RE: Question about Double-checked locking

Doron Rajwan doron at rajwan.org
Sun May 14 10:00:20 EDT 2006


It seems to me that you want two different type of
locks here:
1. locking the map, for "fast" actions.
2. locking a specific key, in order not to load it
from database twice.

If this is correct, just change the map to
sychronizedMap or to ConcurrentHashMap, and the code
will be correct. It will still have locks, even in the
read-only case, however.

Doron


______________________________________________________
Doron Rajwan, doron at rajwan.org, http://www.rajwan.org



More information about the Concurrency-interest mailing list