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

Comparing jsr166/src/main/java/util/concurrent/ConcurrentLinkedQueue.java (file contents):
Revision 1.131 by jsr166, Mon Dec 5 03:02:49 2016 UTC vs.
Revision 1.132 by jsr166, Tue Dec 6 04:41:18 2016 UTC

# Line 301 | Line 301 | public class ConcurrentLinkedQueue<E> ex
301          restartFromHead:
302          for (;;) {
303              for (Node<E> h = head, p = h, q;;) {
304 <                E item = p.item;
305 <
306 <                if (item != null && ITEM.compareAndSet(p, item, null)) {
304 >                final E item;
305 >                if ((item = p.item) != null
306 >                    && ITEM.compareAndSet(p, item, null)) {
307                      // Successful CAS is the linearization point
308                      // for item to be removed from this queue.
309                      if (p != h) // hop two nodes at a time
# Line 326 | Line 326 | public class ConcurrentLinkedQueue<E> ex
326          restartFromHead:
327          for (;;) {
328              for (Node<E> h = head, p = h, q;;) {
329 <                E item = p.item;
330 <                if (item != null || (q = p.next) == null) {
329 >                final E item;
330 >                if ((item = p.item) != null
331 >                    || (q = p.next) == null) {
332                      updateHead(h, p);
333                      return item;
334                  }
# Line 414 | Line 415 | public class ConcurrentLinkedQueue<E> ex
415      public boolean contains(Object o) {
416          if (o != null) {
417              for (Node<E> p = first(); p != null; p = succ(p)) {
418 <                E item = p.item;
419 <                if (item != null && o.equals(item))
418 >                final E item;
419 >                if ((item = p.item) != null && o.equals(item))
420                      return true;
421              }
422          }
# Line 437 | Line 438 | public class ConcurrentLinkedQueue<E> ex
438          if (o != null) {
439              Node<E> next, pred = null;
440              for (Node<E> p = first(); p != null; pred = p, p = next) {
440                final E item;
441                  boolean removed = false;
442                  next = succ(p);
443 +                final E item;
444                  if ((item = p.item) != null) {
445                      if (!o.equals(item))
446                          continue;
# Line 523 | Line 524 | public class ConcurrentLinkedQueue<E> ex
524              int charLength = 0;
525              int size = 0;
526              for (Node<E> p = first(); p != null;) {
527 <                E item = p.item;
528 <                if (item != null) {
527 >                final E item;
528 >                if ((item = p.item) != null) {
529                      if (a == null)
530                          a = new String[4];
531                      else if (size == a.length)
# Line 549 | Line 550 | public class ConcurrentLinkedQueue<E> ex
550          restartFromHead: for (;;) {
551              int size = 0;
552              for (Node<E> p = first(); p != null;) {
553 <                E item = p.item;
554 <                if (item != null) {
553 >                final E item;
554 >                if ((item = p.item) != null) {
555                      if (x == null)
556                          x = new Object[4];
557                      else if (size == x.length)
# Line 732 | Line 733 | public class ConcurrentLinkedQueue<E> ex
733  
734          // Write out all elements in the proper order.
735          for (Node<E> p = first(); p != null; p = succ(p)) {
736 <            Object item = p.item;
737 <            if (item != null)
736 >            final E item;
737 >            if ((item = p.item) != null)
738                  s.writeObject(item);
739          }
740  
# Line 900 | Line 901 | public class ConcurrentLinkedQueue<E> ex
901          boolean removed = false;
902          Node<E> next, pred = null;
903          for (Node<E> p = first(); p != null; pred = p, p = next) {
903            final E item;
904              next = succ(p);
905 +            final E item;
906              if ((item = p.item) != null) {
907                  if (!filter.test(item))
908                      continue;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines