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

Comparing jsr166/src/main/java/util/concurrent/LinkedTransferQueue.java (file contents):
Revision 1.72 by jsr166, Wed Oct 29 20:23:14 2014 UTC vs.
Revision 1.73 by jsr166, Tue Nov 11 04:39:30 2014 UTC

# Line 790 | Line 790 | public class LinkedTransferQueue<E> exte
790       * Used by methods size and getWaitingConsumerCount.
791       */
792      private int countOfMode(boolean data) {
793 <        int count = 0;
794 <        for (Node p = head; p != null; ) {
795 <            if (!p.isMatched()) {
796 <                if (p.isData != data)
797 <                    return 0;
798 <                if (++count == Integer.MAX_VALUE) // saturated
799 <                    break;
800 <            }
801 <            Node n = p.next;
802 <            if (n != p)
803 <                p = n;
804 <            else {
805 <                count = 0;
806 <                p = head;
793 >        restartFromHead: for (;;) {
794 >            int count = 0;
795 >            for (Node p = head; p != null;) {
796 >                if (!p.isMatched()) {
797 >                    if (p.isData != data)
798 >                        return 0;
799 >                    if (++count == Integer.MAX_VALUE)
800 >                        break;  // @see Collection.size()
801 >                }
802 >                Node next = p.next;
803 >                if (p == next)
804 >                    continue restartFromHead;
805 >                p = next;
806              }
807 +            return count;
808          }
809        return count;
809      }
810  
811      final class Itr implements Iterator<E> {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines