commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin A. Burton" <bur...@newsmonster.org>
Subject Re: concurrency and starting a synchronized block
Date Thu, 10 Feb 2005 20:58:24 GMT
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

-- 

Use Rojo (RSS/Atom aggregator).  Visit http://rojo.com. Ask me for an 
invite!  Also see irc.freenode.net #rojo if you want to chat.

Rojo is Hiring! - http://www.rojonetworks.com/JobsAtRojo.html

If you're interested in RSS, Weblogs, Social Networking, etc... then you 
should work for Rojo!  If you recommend someone and we hire them you'll 
get a free iPod!
    
Kevin A. Burton, Location - San Francisco, CA
       AIM/YIM - sfburtonator,  Web - http://peerfear.org/
GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412


---------------------------------------------------------------------
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