harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r768310 - in /harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent: ./ locks/
Date Fri, 24 Apr 2009 13:42:54 GMT
Author: tellison
Date: Fri Apr 24 13:42:54 2009
New Revision: 768310

URL: http://svn.apache.org/viewvc?rev=768310&view=rev
Log:
Apply patch HARMONY-6175 (Javadocs for java.util.concurrent.*)

Modified:
    harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/CopyOnWriteArrayList.java
    harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/LinkedBlockingQueue.java
    harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/TimeUnit.java
    harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/locks/AbstractQueuedSynchronizer.java
    harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/locks/Condition.java
    harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/locks/ReentrantReadWriteLock.java

Modified: harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/CopyOnWriteArrayList.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/CopyOnWriteArrayList.java?rev=768310&r1=768309&r2=768310&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/CopyOnWriteArrayList.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/CopyOnWriteArrayList.java
Fri Apr 24 13:42:54 2009
@@ -31,6 +31,16 @@
 import java.util.RandomAccess;
 import java.util.concurrent.locks.ReentrantLock;
 
+/**
+ * Implements a {@link java.util.ArrayList} variant that is thread-safe. All
+ * write operation result in a new copy of the underlying data being created.
+ * Iterators reflect the state of the CopyOnWriteArrayList at the time they were
+ * created. They are not updated to reflect subsequent changes to the list. In
+ * addition, these iterators cannot be used for modifying the underlying
+ * CopyOnWriteArrayList.
+ *
+ * @param <E> the element type
+ */
 public class CopyOnWriteArrayList<E> implements List<E>, RandomAccess, Cloneable,
Serializable {
 
     private static final long serialVersionUID = 8673264195747942595L;
@@ -42,13 +52,30 @@
      */
     private final transient ReentrantLock lock = new ReentrantLock();
 
+    /**
+     * Creates a new, empty instance of CopyOnWriteArrayList.
+     */
     public CopyOnWriteArrayList() {
     }
 
+    /**
+     * Creates a new instance of CopyOnWriteArrayList and fills it with the
+     * contents of a given Collection.
+     *
+     * @param c     the collection the elements of which are to be copied into
+     *              the new instance.
+     */
     public CopyOnWriteArrayList(Collection<? extends E> c) {
         this((E[]) c.toArray());
     }
 
+    /**
+     * Creates a new instance of CopyOnWriteArrayList and fills it with the
+     * contents of a given array.
+     *
+     * @param array the array the elements of which are to be copied into the
+     *              new instance.
+     */
     public CopyOnWriteArrayList(E[] array) {
         int size = array.length;
         E[] data = newElementArray(size);
@@ -140,6 +167,15 @@
         return true;
     }
 
+    /**
+     * Adds to this CopyOnWriteArrayList all those elements from a given
+     * collection that are not yet part of the list.
+     *
+     * @param c     the collection from which the potential new elements are
+     *              taken.
+     *
+     * @return the number of elements actually added to this list.
+     */
     public int addAllAbsent(Collection<? extends E> c) {
         if (c.size() == 0) {
             return 0;
@@ -166,6 +202,14 @@
         }
     }
 
+    /**
+     * Adds to this CopyOnWriteArrayList another element, given that this
+     * element is not yet part of the list.
+     *
+     * @param e     the potential new element.
+     *
+     * @return true if the element was added, or false otherwise.
+     */
     public boolean addIfAbsent(E e) {
         lock.lock();
         try {
@@ -258,6 +302,16 @@
         return hashCode;
     }
 
+    /**
+     * Returns the index of a given element, starting the search from a given
+     * position in the list.
+     *
+     * @param e     the element to search.
+     * @param index the index at which to start the search.
+     *
+     * @return the index of the element or null, if the element has not been
+     * found at or beyond the given start index.
+     */
     public int indexOf(E e, int index) {
         E[] data = getData();
         return indexOf(e, data, index, data.length - index);
@@ -276,6 +330,16 @@
         return new ListIteratorImpl(getData(), 0);
     }
 
+    /**
+     * Returns the last index of a given element, starting the search from
+     * a given position in the list and going backwards.
+     *
+     * @param e     the element to search.
+     * @param index the index at which to start the search.
+     *
+     * @return the index of the element or null, if the element has not been
+     * found at or before the given start index.
+     */
     public int lastIndexOf(E e, int index) {
         E[] data = getData();
         return lastIndexOf(e, data, 0, index);

Modified: harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/LinkedBlockingQueue.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/LinkedBlockingQueue.java?rev=768310&r1=768309&r2=768310&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/LinkedBlockingQueue.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/LinkedBlockingQueue.java
Fri Apr 24 13:42:54 2009
@@ -216,6 +216,8 @@
      * inspecting <tt>remainingCapacity</tt> because it may be the
      * case that a waiting consumer is ready to <tt>take</tt> an
      * element out of an otherwise full queue.
+     *
+     * @return the remaining capacity
      */
     public int remainingCapacity() {
         return capacity - count.get();

Modified: harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/TimeUnit.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/TimeUnit.java?rev=768310&r1=768309&r2=768310&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/TimeUnit.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/TimeUnit.java
Fri Apr 24 13:42:54 2009
@@ -36,7 +36,14 @@
  * @author Doug Lea
  */
 public enum TimeUnit {
-    NANOSECONDS(0), MICROSECONDS(1), MILLISECONDS(2), SECONDS(3);
+    /** TimeUnit which represents one nanosecond. */
+    NANOSECONDS(0),
+    /** TimeUnit which represents one microsecond. */
+    MICROSECONDS(1),
+    /** TimeUnit which represents one millisecond. */
+    MILLISECONDS(2),
+    /** TimeUnit which represents one second. */
+    SECONDS(3);
 
     /** the index of this unit */
     private final int index;

Modified: harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/locks/AbstractQueuedSynchronizer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/locks/AbstractQueuedSynchronizer.java?rev=768310&r1=768309&r2=768310&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/locks/AbstractQueuedSynchronizer.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/locks/AbstractQueuedSynchronizer.java
Fri Apr 24 13:42:54 2009
@@ -1760,6 +1760,9 @@
          *      {@link #acquire} with saved state as argument.
          * <li> If interrupted while blocked in step 4, throw exception
          * </ol>
+         *
+         * @throws InterruptedException if the current thread is interrupted (and
+         * interruption of thread suspension is supported).
          */
         public final void await() throws InterruptedException {
             if (Thread.interrupted()) 
@@ -1791,6 +1794,15 @@
          *      {@link #acquire} with saved state as argument.
          * <li> If interrupted while blocked in step 4, throw InterruptedException
          * </ol>
+         *
+         * @param nanosTimeout the maximum time to wait, in nanoseconds
+         * @return A value less than or equal to zero if the wait has
+         * timed out; otherwise an estimate, that
+         * is strictly less than the <tt>nanosTimeout</tt> argument,
+         * of the time still remaining when this method returned.
+         *
+         * @throws InterruptedException if the current thread is interrupted (and
+         * interruption of thread suspension is supported).
          */
         public final long awaitNanos(long nanosTimeout) throws InterruptedException {
             if (Thread.interrupted()) 
@@ -1832,6 +1844,13 @@
          * <li> If interrupted while blocked in step 4, throw InterruptedException
          * <li> If timed out while blocked in step 4, return false, else true
          * </ol>
+         *
+         * @param deadline the absolute time to wait until
+         * @return <tt>false</tt> if the deadline has
+         * elapsed upon return, else <tt>true</tt>.
+         *
+         * @throws InterruptedException if the current thread is interrupted (and
+         * interruption of thread suspension is supported).
          */
         public final boolean awaitUntil(Date deadline) throws InterruptedException {
             if (deadline == null)
@@ -1873,6 +1892,13 @@
          * <li> If interrupted while blocked in step 4, throw InterruptedException
          * <li> If timed out while blocked in step 4, return false, else true
          * </ol>
+         *
+         * @param time the maximum time to wait
+         * @param unit the time unit of the <tt>time</tt> argument.
+         * @return <tt>false</tt> if the waiting time detectably elapsed
+         * before return from the method, else <tt>true</tt>.
+         * @throws InterruptedException if the current thread is interrupted (and
+         * interruption of thread suspension is supported).
          */
         public final boolean await(long time, TimeUnit unit) throws InterruptedException
{
             if (unit == null)

Modified: harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/locks/Condition.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/locks/Condition.java?rev=768310&r1=768309&r2=768310&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/locks/Condition.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/locks/Condition.java
Fri Apr 24 13:42:54 2009
@@ -421,7 +421,7 @@
     void signal();
 
     /**
-     * Wake up all waiting threads.
+     * Wakes up all waiting threads.
      *
      * <p>If any threads are waiting on this condition then they are
      * all woken up. Each thread must re-acquire the lock before it can

Modified: harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/locks/ReentrantReadWriteLock.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/locks/ReentrantReadWriteLock.java?rev=768310&r1=768309&r2=768310&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/locks/ReentrantReadWriteLock.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/locks/ReentrantReadWriteLock.java
Fri Apr 24 13:42:54 2009
@@ -398,7 +398,7 @@
         private final Sync sync;
         
         /** 
-         * Constructor for use by subclasses 
+         * Constructor for use by subclasses.
          * @param lock the outer lock object
          * @throws NullPointerException if lock null
          */
@@ -576,6 +576,8 @@
         /**
          * Throws UnsupportedOperationException because ReadLocks
          * do not support conditions.
+         * @return A new {@link Condition} instance for this <tt>Lock</tt>
+         * instance.
          * @throws UnsupportedOperationException always
          */
         public Condition newCondition() {
@@ -605,7 +607,7 @@
         private final Sync sync;
         
         /** 
-         * Constructor for use by subclasses 
+         * Constructor for use by subclasses.
          * @param lock the outer lock object
          * @throws NullPointerException if lock null
          */



Mime
View raw message