Collections.synchronizedMap(new HashMap())
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   elena_elena
Posted On:   Monday, March 15, 2004 05:46 AM

Hello ,
I want to lock a HashMap for writers and readers only if someone is writing, but if only there are reader threads i don't want to lock it.
Someone can tell me if Collections.synchronizedMap(new HashMap()) is what i'm looking for??, or i have to do it manually.
Best Regards. Elena

Re: Collections.synchronizedMap(new HashMap())

Posted By:   Hendrik_Schreiber  
Posted On:   Thursday, March 18, 2004 06:09 AM

No, Collections.synchronizedMap(new HashMap()) offers only pretty raw locking.

Check out http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html

In particular: ConcurentReaderHashMap

For more info on concurrency I can highly recommend Doug Lea's book. It's the best you can get...

About | Sitemap | Contact