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

Comparing jsr166/src/main/java/util/concurrent/LinkedBlockingQueue.java (file contents):
Revision 1.52 by jsr166, Wed Jul 29 20:53:30 2009 UTC vs.
Revision 1.53 by jsr166, Mon Aug 31 21:48:14 2009 UTC

# Line 737 | Line 737 | public class LinkedBlockingQueue<E> exte
737          }
738  
739          /**
740 <         * Unlike other traversal methods, iterators need to handle:
740 >         * Returns the next live successor of p, or null if no such.
741 >         *
742 >         * Unlike other traversal methods, iterators need to handle both:
743           * - dequeued nodes (p.next == p)
744 <         * - interior removed nodes (p.item == null)
744 >         * - (possibly multiple) interior removed nodes (p.item == null)
745           */
746          private Node<E> nextNode(Node<E> p) {
747 <            Node<E> s = p.next;
748 <            if (p == s)
749 <                return head.next;
750 <            // Skip over removed nodes.
751 <            // May be necessary if multiple interior Nodes are removed.
752 <            while (s != null && s.item == null)
753 <                s = s.next;
754 <            return s;
747 >            for (;;) {
748 >                Node<E> s = p.next;
749 >                if (s == p)
750 >                    return head.next;
751 >                if (s == null || s.item != null)
752 >                    return s;
753 >                p = s;
754 >            }
755          }
756  
757          public E next() {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines