[cvs] / jsr166 / src / main / java / util / concurrent / LinkedTransferQueue.java Repository:
ViewVC logotype

Diff of /jsr166/src/main/java/util/concurrent/LinkedTransferQueue.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5, Fri Jul 31 20:41:13 2009 UTC revision 1.6, Mon Aug 3 01:18:07 2009 UTC
# Line 16  Line 16 
16  import java.util.concurrent.atomic.AtomicReference;  import java.util.concurrent.atomic.AtomicReference;
17    
18  /**  /**
19   * An unbounded {@linkplain TransferQueue} based on linked nodes.   * An unbounded {@link TransferQueue} based on linked nodes.
20   * This queue orders elements FIFO (first-in-first-out) with respect   * This queue orders elements FIFO (first-in-first-out) with respect
21   * to any given producer.  The <em>head</em> of the queue is that   * to any given producer.  The <em>head</em> of the queue is that
22   * element that has been on the queue the longest time for some   * element that has been on the queue the longest time for some
# Line 492  Line 492 
492      }      }
493    
494      /**      /**
495       * Transfers the specified element immediately if there exists a       * Transfers the element to a waiting consumer immediately, if possible.
496       * consumer already waiting to receive it (in {@link #take} or       *
497       * timed {@link #poll(long,TimeUnit) poll}), otherwise       * <p>More precisely, transfers the specified element immediately
498       * returning {@code false} without enqueuing the element.       * if there exists a consumer already waiting to receive it (in
499         * {@link #take} or timed {@link #poll(long,TimeUnit) poll}),
500         * otherwise returning {@code false} without enqueuing the element.
501       *       *
502       * @throws NullPointerException if the specified element is null       * @throws NullPointerException if the specified element is null
503       */       */
# Line 505  Line 507 
507      }      }
508    
509      /**      /**
510       * Inserts the specified element at the tail of this queue,       * Transfers the element to a consumer, waiting if necessary to do so.
511       * waiting if necessary for the element to be received by a       *
512       * consumer invoking {@code take} or {@code poll}.       * <p>More precisely, transfers the specified element immediately
513         * if there exists a consumer already waiting to receive it (in
514         * {@link #take} or timed {@link #poll(long,TimeUnit) poll}),
515         * else inserts the specified element at the tail of this queue
516         * and waits until the element is received by a consumer.
517       *       *
518       * @throws NullPointerException if the specified element is null       * @throws NullPointerException if the specified element is null
519       */       */
# Line 520  Line 526 
526      }      }
527    
528      /**      /**
529       * Inserts the specified element at the tail of this queue,       * Transfers the element to a consumer if it is possible to do so
530       * waiting up to the specified wait time if necessary for the       * before the timeout elapses.
531       * element to be received by a consumer invoking {@code take} or       *
532       * {@code poll}.       * <p>More precisely, transfers the specified element immediately
533         * if there exists a consumer already waiting to receive it (in
534         * {@link #take} or timed {@link #poll(long,TimeUnit) poll}),
535         * else inserts the specified element at the tail of this queue
536         * and waits until the element is received by a consumer,
537         * returning {@code false} if the specified wait time elapses
538         * before the element can be transferred.
539       *       *
540       * @throws NullPointerException if the specified element is null       * @throws NullPointerException if the specified element is null
541       */       */
# Line 720  Line 732 
732          }          }
733      }      }
734    
735        /**
736         * Returns {@code true} if this queue contains no elements.
737         *
738         * @return {@code true} if this queue contains no elements
739         */
740      public boolean isEmpty() {      public boolean isEmpty() {
741          for (;;) {          for (;;) {
742              Node<E> h = traversalHead();              Node<E> h = traversalHead();
# Line 801  Line 818 
818          }          }
819      }      }
820    
821        /**
822         * Removes a single instance of the specified element from this queue,
823         * if it is present.  More formally, removes an element {@code e} such
824         * that {@code o.equals(e)}, if this queue contains one or more such
825         * elements.
826         * Returns {@code true} if this queue contained the specified element
827         * (or equivalently, if this queue changed as a result of the call).
828         *
829         * @param o element to be removed from this queue, if present
830         * @return {@code true} if this queue changed as a result of the call
831         */
832      public boolean remove(Object o) {      public boolean remove(Object o) {
833          if (o == null)          if (o == null)
834              return false;              return false;

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8