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

Comparing jsr166/src/main/java/util/concurrent/ConcurrentLinkedDeque.java (file contents):
Revision 1.36 by dl, Mon Feb 25 17:59:40 2013 UTC vs.
Revision 1.37 by dl, Tue Feb 26 12:15:07 2013 UTC

# Line 1377 | Line 1377 | public class ConcurrentLinkedDeque<E>
1377              Node<E> p; int n;
1378              final ConcurrentLinkedDeque<E> q = this.queue;
1379              if (!exhausted && (n = batch + 1) > 0 && n <= MAX_BATCH &&
1380 <                ((p = current) != null || (p = q.first()) != null) &&
1381 <                p.next != null) {
1382 <                Object[] a = new Object[batch = n];
1383 <                int i = 0;
1384 <                do {
1385 <                    if ((a[i] = p.item) != null)
1386 <                        ++i;
1387 <                    if (p == (p = p.next))
1388 <                        p = q.first();
1389 <                } while (p != null && i < n);
1390 <                if ((current = p) == null)
1391 <                    exhausted = true;
1392 <                return Spliterators.spliterator
1393 <                    (a, 0, i, Spliterator.ORDERED | Spliterator.NONNULL |
1394 <                     Spliterator.CONCURRENT);
1380 >                ((p = current) != null || (p = q.first()) != null)) {
1381 >                if (p.item == null && p == (p = p.next))
1382 >                    current = p = q.first();
1383 >                if (p.next != null) {
1384 >                    Object[] a = new Object[batch = n];
1385 >                    int i = 0;
1386 >                    do {
1387 >                        if ((a[i] = p.item) != null)
1388 >                            ++i;
1389 >                        if (p == (p = p.next))
1390 >                            p = q.first();
1391 >                    } while (p != null && i < n);
1392 >                    if ((current = p) == null)
1393 >                        exhausted = true;
1394 >                    return Spliterators.spliterator
1395 >                        (a, 0, i, Spliterator.ORDERED | Spliterator.NONNULL |
1396 >                         Spliterator.CONCURRENT);
1397 >                }
1398              }
1399              return null;
1400          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines