You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ce...@apache.org on 2003/07/10 19:05:37 UTC
cvs commit: jakarta-log4j/src/java/org/apache/log4j/helpers ReaderWriterLock.java
ceki 2003/07/10 10:05:37
Modified: src/java/org/apache/log4j/helpers ReaderWriterLock.java
Log:
Added some more documentation on ReadWriterLock
Revision Changes Path
1.3 +17 -0 jakarta-log4j/src/java/org/apache/log4j/helpers/ReaderWriterLock.java
Index: ReaderWriterLock.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/helpers/ReaderWriterLock.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ReaderWriterLock.java 2 Jun 2003 17:45:05 -0000 1.2
+++ ReaderWriterLock.java 10 Jul 2003 17:05:37 -0000 1.3
@@ -60,6 +60,23 @@
* When both readers and writers wait to obtain the lock, priority is given to
* waiting writers.
*
+ * This lock is not reentrant. It is possible for a writer in possession of a writer
+ * lock to fail to obtain a reader lock. The same goes for reader in possession of a
+ * reader lock. It can fail to obtain a writer lock.
+ *
+ * THIS LOCK IS NOT RENTRANT.
+ *
+ * It is the developer's responsability to retstrict the use of this lock to small segments
+ * of code where reentrancy can be avoided.
+ *
+ * Note that the RederWriterLock is only useful in cases where a resource:
+ *
+ * 1) Has many frequent read operations performed on it
+ * 2) Only rarely is the resource modified (written)
+ * 3) Read operations are invoked by many different threads
+ *
+ * If any of the above conditions are not met, it is better to avoid this fancy lock.
+ *
* @author Ceki Gülcü
*
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-dev-help@jakarta.apache.org