[concurrency-interest] Question about Double-checked locking

Tutika Chakravarthy chakritsus at yahoo.com
Sun May 14 08:34:41 EDT 2006


> > No changing from synchronized to Lock doesn't make
> a difference to the
> > double-check part. You must establish a
> "happens-before" relationship
> > between the thread setting the value in the map,
> and the thread
> > reading it.

Can you elaborate "happens-before" relationship part?
Suppose If I replace HashMap wih ConcurrentHashMap,
How can I avoid double-checked locking problem.
My Aim is that if the value is not present in the map
for a key , load it from Database. Otherwise simply
use get() method  and return it.

Tutika

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Concurrency-interest mailing list