[concurrency-interest] backport: ReentrantReadWriteLock question

Lindley M French lfrench1 at gmu.edu
Fri Dec 5 16:42:22 EST 2008

I notice that the Backport implementation of ReentrantReadWriteLock does not quite match the Java 1.5 version, in particular its imposition without option of a writer preference.

I have a circumstance where I need reader preference. Under Java 1.5, it seems that the ReentrantReadWriteLock::ReadLock::tryLock() function provides "barging" behavior which would allow one to effectively enforce reader preference no matter what scheduling policy the lock tries to use normally.

The javadoc for the Backport version *claims* to have this same behavior, but I'm left wondering whether it's really true or just a copy/paste from the 1.5 version's javadoc. I'm especially suspicious since Java 1.5's javadoc claims to have "barging" behavior for the tryLock function of the *write* lock as well, even though that doesn't make any sense.

Could it be clarified whether there is a means to enforce reader preference using backport or not?

More information about the Concurrency-interest mailing list