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.111 by jsr166, Sat May 6 06:49:46 2017 UTC vs.
Revision 1.112 by jsr166, Mon Jan 8 20:20:38 2018 UTC

# Line 1031 | Line 1031 | public class LinkedBlockingQueue<E> exte
1031          int n, len = 0;
1032          do {
1033              // 1. Extract batch of up to 64 elements while holding the lock.
1034            long deathRow = 0;          // "bitset" of size 64
1034              fullyLock();
1035              try {
1036 <                if (nodes == null) {
1037 <                    if (p == null) p = head.next;
1036 >                if (nodes == null) {  // first batch; initialize
1037 >                    p = head.next;
1038                      for (Node<E> q = p; q != null; q = succ(q))
1039                          if (q.item != null && ++len == 64)
1040                              break;
# Line 1048 | Line 1047 | public class LinkedBlockingQueue<E> exte
1047              }
1048  
1049              // 2. Run the filter on the elements while lock is free.
1050 +            long deathRow = 0L;       // "bitset" of size 64
1051              for (int i = 0; i < n; i++) {
1052                  final E e;
1053                  if ((e = nodes[i].item) != null && filter.test(e))
# Line 1066 | Line 1066 | public class LinkedBlockingQueue<E> exte
1066                              unlink(q, ancestor);
1067                              removed = true;
1068                          }
1069 +                        nodes[i] = null; // help GC
1070                      }
1071                  } finally {
1072                      fullyUnlock();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines