KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > logicalcobwebs > concurrent > ReaderPreferenceReadWriteLock


1 /*
2   File: ReaderPreferenceReadWriteLock.java
3
4   Originally written by Doug Lea and released into the public domain.
5   This may be used for any purposes whatsoever without acknowledgment.
6   Thanks for the assistance and support of Sun Microsystems Labs,
7   and everyone contributing, testing, and using this code.
8
9   History:
10   Date Who What
11   11Jun1998 dl Create public version
12 */

13
14 package org.logicalcobwebs.concurrent;
15
16 /**
17  * A ReadWriteLock that prefers waiting readers over
18  * waiting writers when there is contention. The range of applicability
19  * of this class is very limited. In the majority of situations,
20  * writer preference locks provide more reasonable semantics.
21  *
22  * <p>[<a HREF="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html"> Introduction to this package. </a>]
23  **/

24
25 public class ReaderPreferenceReadWriteLock extends WriterPreferenceReadWriteLock {
26     protected boolean allowReader() {
27         return activeWriter_ == null;
28     }
29 }
30
31
Popular Tags