Removed DOCUMENT ME comments that were generated and applied source code
[utils] / support / general / src / main / java / org / wamblee / concurrency / ReadWriteLock.java
index 678801d50140f13373f3dfe88980365812c458ef..0ee0d5b2b0c68450a47c0735d22c931aeb5f741c 100644 (file)
@@ -17,7 +17,6 @@ package org.wamblee.concurrency;
 
 import java.util.HashSet;
 
-
 /**
  * Read-write lock for allowing multiple concurrent readers or at most one
  * writer. This implementation does not aim for high performance but for
@@ -26,10 +25,10 @@ import java.util.HashSet;
  */
 public class ReadWriteLock {
     /**
-     * Sets containing the references to the threads that are currently
-     * reading. This administration is useful to check that the lock has
-     * already been  acquired before it is release. This check adds robustness
-     * to the application.
+     * Sets containing the references to the threads that are currently reading.
+     * This administration is useful to check that the lock has already been
+     * acquired before it is release. This check adds robustness to the
+     * application.
      */
     private HashSet<Thread> readers;
 
@@ -48,23 +47,23 @@ public class ReadWriteLock {
     }
 
     /**
-     * Acquires the lock for reading. This call will block until the lock can
-     * be acquired.
-     *
-     * @throws IllegalStateException Thrown if the read or  write lock is
-     *         already acquired.
+     * Acquires the lock for reading. This call will block until the lock can be
+     * acquired.
+     * 
+     * @throws IllegalStateException
+     *             Thrown if the read or write lock is already acquired.
      */
     public synchronized void acquireRead() {
         if (readers.contains(Thread.currentThread())) {
             throw new IllegalStateException(
                 "Read lock already acquired by current thread: " +
-                Thread.currentThread());
+                    Thread.currentThread());
         }
 
         if (writer == Thread.currentThread()) {
             throw new IllegalStateException(
                 "Trying to acquire the read lock while already holding a write lock: " +
-                Thread.currentThread());
+                    Thread.currentThread());
         }
 
         while (writer != null) {
@@ -79,11 +78,11 @@ public class ReadWriteLock {
     }
 
     /**
-     * Releases the lock for reading. Note: This implementation assumes that
-     * the lock has already been acquired for reading previously.
-     *
-     * @throws IllegalStateException Thrown when the lock was not acquired by
-     *         this thread.
+     * Releases the lock for reading. Note: This implementation assumes that the
+     * lock has already been acquired for reading previously.
+     * 
+     * @throws IllegalStateException
+     *             Thrown when the lock was not acquired by this thread.
      */
     public synchronized void releaseRead() {
         if (!readers.remove(Thread.currentThread())) {
@@ -99,25 +98,25 @@ public class ReadWriteLock {
     /**
      * Acquires the lock for writing. This call will block until the lock has
      * been acquired.
-     *
-     * @throws IllegalStateException Thrown if the read or write lock is
-     *         already acquired.
+     * 
+     * @throws IllegalStateException
+     *             Thrown if the read or write lock is already acquired.
      */
     public synchronized void acquireWrite() {
         if (writer == Thread.currentThread()) {
             throw new IllegalStateException(
                 "Trying to acquire a write lock while already holding the write lock: " +
-                Thread.currentThread());
+                    Thread.currentThread());
         }
 
         if (readers.contains(Thread.currentThread())) {
             throw new IllegalStateException(
                 "Trying to acquire a write lock while already holding the read lock: " +
-                Thread.currentThread());
+                    Thread.currentThread());
         }
 
         // wait until there are no more writers and no more
-        // readers 
+        // readers
         while ((writer != null) || (readers.size() > 0)) {
             try {
                 wait();
@@ -134,8 +133,9 @@ public class ReadWriteLock {
 
     /**
      * Releases the lock for writing.
-     *
-     * @throws IllegalStateException Thrown when the lock was not acquired.
+     * 
+     * @throws IllegalStateException
+     *             Thrown when the lock was not acquired.
      */
     public synchronized void releaseWrite() {
         if (writer != Thread.currentThread()) {