--- old/src/share/classes/java/util/concurrent/LinkedTransferQueue.java Mon Dec 5 14:58:19 2011 +++ new/src/share/classes/java/util/concurrent/LinkedTransferQueue.java Mon Dec 5 14:58:19 2011 @@ -330,8 +330,8 @@ * of less-contended queues. During spins threads check their * interrupt status and generate a thread-local random number * to decide to occasionally perform a Thread.yield. While - * yield has underdefined specs, we assume that might it help, - * and will not hurt in limiting impact of spinning on busy + * yield has underdefined specs, we assume that it might help, + * and will not hurt, in limiting impact of spinning on busy * systems. We also use smaller (1/2) spins for nodes that are * not known to be front but whose predecessors have not * blocked -- these "chained" spins avoid artifacts of @@ -542,7 +542,7 @@ static { try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class k = Node.class; + Class k = Node.class; itemOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("item")); nextOffset = UNSAFE.objectFieldOffset @@ -627,7 +627,7 @@ break; // unless slack < 2 } LockSupport.unpark(p.waiter); - return this.cast(item); + return LinkedTransferQueue.cast(item); } } Node n = p.next; @@ -705,7 +705,7 @@ if (item != e) { // matched // assert item != s; s.forgetContents(); // avoid garbage - return this.cast(item); + return LinkedTransferQueue.cast(item); } if ((w.isInterrupted() || (timed && nanos <= 0)) && s.casItem(e, s)) { // cancel @@ -786,7 +786,7 @@ Object item = p.item; if (p.isData) { if (item != null && item != p) - return this.cast(item); + return LinkedTransferQueue.cast(item); } else if (item == null) return null; @@ -1008,7 +1008,6 @@ return false; } - /** * Creates an initially empty {@code LinkedTransferQueue}. */ @@ -1045,7 +1044,8 @@ * return {@code false}. * * @return {@code true} (as specified by - * {@link BlockingQueue#offer(Object,long,TimeUnit) BlockingQueue.offer}) + * {@link java.util.concurrent.BlockingQueue#offer(Object,long,TimeUnit) + * BlockingQueue.offer}) * @throws NullPointerException if the specified element is null */ public boolean offer(E e, long timeout, TimeUnit unit) { @@ -1162,8 +1162,7 @@ if (c == this) throw new IllegalArgumentException(); int n = 0; - E e; - while ( (e = poll()) != null) { + for (E e; (e = poll()) != null;) { c.add(e); ++n; } @@ -1180,8 +1179,7 @@ if (c == this) throw new IllegalArgumentException(); int n = 0; - E e; - while (n < maxElements && (e = poll()) != null) { + for (E e; n < maxElements && (e = poll()) != null;) { c.add(e); ++n; } @@ -1288,7 +1286,8 @@ * {@code LinkedTransferQueue} is not capacity constrained. * * @return {@code Integer.MAX_VALUE} (as specified by - * {@link BlockingQueue#remainingCapacity()}) + * {@link java.util.concurrent.BlockingQueue#remainingCapacity() + * BlockingQueue.remainingCapacity}) */ public int remainingCapacity() { return Integer.MAX_VALUE; @@ -1337,7 +1336,7 @@ static { try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class k = LinkedTransferQueue.class; + Class k = LinkedTransferQueue.class; headOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("head")); tailOffset = UNSAFE.objectFieldOffset