commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From WHIRLYCOTT <p...@whirlycott.com>
Subject Re: concurrency and starting a synchronized block
Date Thu, 10 Feb 2005 21:50:11 GMT
I guess this thread should end soon, but while we're still having some 
fun ... ;)

ConcurrentHashMap can do concurrent put() operations and concurrent 
get() operations... and that's the tricky part.

I just love all that stuff that Doug Lea has done.  For those who 
haven't looked at util.concurrent, I recommend it.  Sounds like others 
do as well.

phil.

Kevin A. Burton wrote:
> Torsten Curdt wrote:
> 
>> Guys, forgive me if this too off topic...
>>
>> ...but I thought it is somehow related to
>> collections that's why I am bringing it up
>> here anyway. I bet someone of you will know....
> 
> 
> 
> Ignore what everyone else says on this list topic.  ha.
> 
> Use a ReentrantReadWriteLock from JDK 1.5.  There's a backport to JDK 
> 1.4 out on the net. Google for "backport concurrent oswego" or something
> 
> Then you can do a
> 
>    lock.readLock().lock()
> 
> on our gets and then do a writeLock on your puts.  the writeLock will 
> backup the readlock but if you only have readlocks they can all happen 
> at once.
> 
> Normally though its not too big a deal since gets() on a hashtable are 
> O(1)....
> 
> Kevin
> 

-- 
                                   Whirlycott
                                   Philip Jacob
                                   phil@whirlycott.com
                                   http://www.whirlycott.com/phil/

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message