ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/LinkedQueue.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/LinkedQueue.java (file contents):
Revision 1.5 by dl, Sun Jun 22 14:27:18 2003 UTC vs.
Revision 1.6 by dl, Tue Jun 24 14:34:48 2003 UTC

# Line 24 | Line 24 | import java.util.concurrent.atomic.*;
24   * is <em>NOT</em> a constant-time operation. Because of the
25   * asynchronous nature of these queues, determining the current number
26   * of elements requires an O(n) traversal.
27 + * @since 1.5
28 + * @author Doug Lea
29   *
30   **/
31   public class LinkedQueue<E> extends AbstractQueue<E>
# Line 41 | Line 43 | public class LinkedQueue<E> extends Abst
43  
44      // Atomics support
45  
46 <    private final static AtomicReferenceFieldUpdater<LinkedQueue, AtomicLinkedNode> tailUpdater = new AtomicReferenceFieldUpdater<LinkedQueue, AtomicLinkedNode>(new LinkedQueue[0], new AtomicLinkedNode[0], "tail");
47 <    private final static AtomicReferenceFieldUpdater<LinkedQueue, AtomicLinkedNode> headUpdater = new AtomicReferenceFieldUpdater<LinkedQueue, AtomicLinkedNode>(new LinkedQueue[0], new AtomicLinkedNode[0], "head");
46 >    private static final AtomicReferenceFieldUpdater<LinkedQueue, AtomicLinkedNode> tailUpdater = new AtomicReferenceFieldUpdater<LinkedQueue, AtomicLinkedNode>(new LinkedQueue[0], new AtomicLinkedNode[0], "tail");
47 >    private static final AtomicReferenceFieldUpdater<LinkedQueue, AtomicLinkedNode> headUpdater = new AtomicReferenceFieldUpdater<LinkedQueue, AtomicLinkedNode>(new LinkedQueue[0], new AtomicLinkedNode[0], "head");
48  
49      private boolean casTail(AtomicLinkedNode cmp, AtomicLinkedNode val) {
50          return tailUpdater.compareAndSet(this, cmp, val);
# Line 81 | Line 83 | public class LinkedQueue<E> extends Abst
83      }
84  
85      public boolean offer(E x) {
86 <        if (x == null) throw new IllegalArgumentException();
86 >        if (x == null) throw new NullPointerException();
87          AtomicLinkedNode n = new AtomicLinkedNode(x, null);
88          for(;;) {
89              AtomicLinkedNode t = tail;
# Line 333 | Line 335 | public class LinkedQueue<E> extends Abst
335       *
336       * @serialData All of the elements (each an <tt>E</tt>) in
337       * the proper order, followed by a null
338 +     * @param s the stream
339       */
340      private void writeObject(java.io.ObjectOutputStream s)
341          throws java.io.IOException {
# Line 354 | Line 357 | public class LinkedQueue<E> extends Abst
357      /**
358       * Reconstitute the Queue instance from a stream (that is,
359       * deserialize it).
360 +     * @param s the stream
361       */
362      private void readObject(java.io.ObjectInputStream s)
363          throws java.io.IOException, ClassNotFoundException {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines