[concurrency-interest] Upgrading a RL to WL inReentrantReadWriteLock
dcholmes at optusnet.com.au
Tue Dec 5 17:17:44 EST 2006
This same question was asked only the other week.
See my response there as to original motivation to not support upgrading to
a write lock.
> -----Original Message-----
> From: concurrency-interest-bounces at cs.oswego.edu
> [mailto:concurrency-interest-bounces at cs.oswego.edu]On Behalf Of Bela Ban
> Sent: Wednesday, 6 December 2006 2:26 AM
> To: concurrency interest
> Subject: [concurrency-interest] Upgrading a RL to WL
> Apologies if this has been asked before - I tried to google and search
> the concurrency-interest mailing list archives, to no avail (note that
> the archives at
> http://altair.cs.oswego.edu/mailman/private/concurrency-interest/ cannot
> be searched ! It would be good if you guys could change this...).
> We're using our own reentrant lock classes in JBossCache
> (http://labs.jboss.com/portal/jbosscache/), but we'd like to replace
> them with the java.util.concurrent.* equivalent classes. However, for
> ReentrantReadWriteLock, we need upgrading capabilities from RLs tro WLs.
> >From the documentation of RRWL:
> * *Lock downgrading*
> Reentrancy also allows downgrading from the write lock to a read
> lock, by acquiring the write lock, then the read lock and then
> releasing the write lock. However, upgrading from a read lock to
> the write lock is *not* possible.
> What was the rationale for this ?
> We would prefer *not* to release the RL first, then acquire the WL, as
> other threads might then be able to acquire RLs or WLs after the
> original thread releases the RL but before it acquires the WL.
> Bela Ban
> Lead JGroups / JBoss Clustering team
> JBoss - a division of Red Hat
> Concurrency-interest mailing list
> Concurrency-interest at altair.cs.oswego.edu
More information about the Concurrency-interest