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

Comparing jsr166/src/jsr166y/LinkedTransferQueue.java (file contents):
Revision 1.72 by dl, Mon Apr 5 15:50:51 2010 UTC vs.
Revision 1.73 by dl, Tue Aug 17 18:30:33 2010 UTC

# Line 15 | Line 15 | import java.util.Iterator;
15   import java.util.NoSuchElementException;
16   import java.util.Queue;
17   import java.util.concurrent.locks.LockSupport;
18 +
19   /**
20   * An unbounded {@link TransferQueue} based on linked nodes.
21   * This queue orders elements FIFO (first-in-first-out) with respect
# Line 422 | Line 423 | public class LinkedTransferQueue<E> exte
423          }
424  
425          final boolean casItem(Object cmp, Object val) {
426 <            assert cmp == null || cmp.getClass() != Node.class;
426 >            //            assert cmp == null || cmp.getClass() != Node.class;
427              return UNSAFE.compareAndSwapObject(this, itemOffset, cmp, val);
428          }
429  
# Line 446 | Line 447 | public class LinkedTransferQueue<E> exte
447          /**
448           * Sets item to self and waiter to null, to avoid garbage
449           * retention after matching or cancelling. Uses relaxed writes
450 <         * bacause order is already constrained in the only calling
450 >         * because order is already constrained in the only calling
451           * contexts: item is forgotten only after volatile/atomic
452           * mechanics that extract items.  Similarly, clearing waiter
453           * follows either CAS or return from park (if ever parked;
# Line 488 | Line 489 | public class LinkedTransferQueue<E> exte
489           * Tries to artificially match a data node -- used by remove.
490           */
491          final boolean tryMatchData() {
492 <            assert isData;
492 >            //            assert isData;
493              Object x = item;
494              if (x != null && x != this && casItem(x, null)) {
495                  LockSupport.unpark(waiter);
# Line 541 | Line 542 | public class LinkedTransferQueue<E> exte
542  
543      @SuppressWarnings("unchecked")
544      static <E> E cast(Object item) {
545 <        assert item == null || item.getClass() != Node.class;
545 >        //        assert item == null || item.getClass() != Node.class;
546          return (E) item;
547      }
548  
# Line 656 | Line 657 | public class LinkedTransferQueue<E> exte
657          for (;;) {
658              Object item = s.item;
659              if (item != e) {                  // matched
660 <                assert item != s;
660 >                //                assert item != s;
661                  s.forgetContents();           // avoid garbage
662                  return this.<E>cast(item);
663              }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines