You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by nd...@apache.org on 2009/10/11 05:38:09 UTC

svn commit: r824008 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/ref/ReferenceQueue.java

Author: ndbeyer
Date: Sun Oct 11 03:38:08 2009
New Revision: 824008

URL: http://svn.apache.org/viewvc?rev=824008&view=rev
Log:
convert tabs to spaces

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/ref/ReferenceQueue.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/ref/ReferenceQueue.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/ref/ReferenceQueue.java?rev=824008&r1=824007&r2=824008&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/ref/ReferenceQueue.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/ref/ReferenceQueue.java Sun Oct 11 03:38:08 2009
@@ -30,11 +30,11 @@
     
     private Reference<? extends T>[] references;
 
-	private int head;
+    private int head;
     
     private int tail;
 
-	private boolean empty;
+    private boolean empty;
     
     /**
      * Constructs a new instance of this class.
@@ -52,33 +52,33 @@
         return new Reference[size];
     }
 
-	/**
+    /**
      * Returns the next available reference from the queue, removing it in the
      * process. Does not wait for a reference to become available.
      *
      * @return the next available reference, or {@code null} if no reference is
      *         immediately available
-	 */
-	public Reference<? extends T> poll() {
-		Reference<? extends T> ref;
-
-		synchronized (this) {
-			if (empty) {
-				return null;
-			}
-			ref = references[head++];
-			ref.dequeue();
-			if (head == references.length) {
-				head = 0;
-			}
-			if (head == tail) {
-				empty = true;
-			}
-		}
-		return ref;
-	}
+     */
+    public Reference<? extends T> poll() {
+        Reference<? extends T> ref;
+
+        synchronized (this) {
+            if (empty) {
+                return null;
+            }
+            ref = references[head++];
+            ref.dequeue();
+            if (head == references.length) {
+                head = 0;
+            }
+            if (head == tail) {
+                empty = true;
+            }
+        }
+        return ref;
+    }
 
-	/**
+    /**
      * Returns the next available reference from the queue, removing it in the
      * process. Waits indefinitely for a reference to become available.
      *
@@ -86,12 +86,12 @@
      *
      * @throws InterruptedException
      *             if the blocking call was interrupted for some reason
-	 */
-	public Reference<? extends T> remove() throws InterruptedException {
-		return remove(0L);
-	}
+     */
+    public Reference<? extends T> remove() throws InterruptedException {
+        return remove(0L);
+    }
 
-	/**
+    /**
      * Returns the next available reference from the queue, removing it in the
      * process. Waits for a reference to become available or the given timeout
      * period to elapse, whichever happens first.
@@ -106,45 +106,45 @@
      *             if the wait period is negative.
      * @throws InterruptedException
      *             if the blocking call was interrupted for some reason
-	 */
-	public Reference<? extends T> remove(long timeout) throws IllegalArgumentException,
-			InterruptedException {
-		if (timeout < 0) {
-			throw new IllegalArgumentException();
-		}
-
-		Reference<? extends T> ref;
-		synchronized (this) {
-			if (empty) {
-				wait(timeout);
-				if (empty) {
-					return null;
-				}
-			}
-			ref = references[head++];
-			ref.dequeue();
-			if (head == references.length) {
-				head = 0;
-			}
-			if (head == tail) {
-				empty = true;
-			} else {
-				notifyAll();
-			}
-		}
-		return ref;
-	}
-
-	/**
-	 * Enqueue the reference object on the receiver.
-	 *
-	 * @param reference
-	 *            reference object to be enqueued.
-	 * @return boolean true if reference is enqueued. false if reference failed
-	 *         to enqueue.
-	 */
+     */
+    public Reference<? extends T> remove(long timeout) throws IllegalArgumentException,
+            InterruptedException {
+        if (timeout < 0) {
+            throw new IllegalArgumentException();
+        }
+
+        Reference<? extends T> ref;
+        synchronized (this) {
+            if (empty) {
+                wait(timeout);
+                if (empty) {
+                    return null;
+                }
+            }
+            ref = references[head++];
+            ref.dequeue();
+            if (head == references.length) {
+                head = 0;
+            }
+            if (head == tail) {
+                empty = true;
+            } else {
+                notifyAll();
+            }
+        }
+        return ref;
+    }
+
+    /**
+     * Enqueue the reference object on the receiver.
+     *
+     * @param reference
+     *            reference object to be enqueued.
+     * @return boolean true if reference is enqueued. false if reference failed
+     *         to enqueue.
+     */
     boolean enqueue(Reference<? extends T> reference) {
-		synchronized (this) {
+        synchronized (this) {
             if (!empty && head == tail) {
                 /* Queue is full - grow */
                 int newQueueSize = (int) (references.length * 1.10);
@@ -165,5 +165,5 @@
             notifyAll();
         }
         return true;
-	}
+    }
 }