301 |
|
* of less-contended queues. During spins threads check their |
302 |
|
* interrupt status and generate a thread-local random number |
303 |
|
* to decide to occasionally perform a Thread.yield. While |
304 |
< |
* yield has underdefined specs, we assume that might it help, |
305 |
< |
* and will not hurt in limiting impact of spinning on busy |
304 |
> |
* yield has underdefined specs, we assume that it might help, |
305 |
> |
* and will not hurt, in limiting impact of spinning on busy |
306 |
|
* systems. We also use smaller (1/2) spins for nodes that are |
307 |
|
* not known to be front but whose predecessors have not |
308 |
|
* blocked -- these "chained" spins avoid artifacts of |
513 |
|
static { |
514 |
|
try { |
515 |
|
UNSAFE = getUnsafe(); |
516 |
< |
Class k = Node.class; |
516 |
> |
Class<?> k = Node.class; |
517 |
|
itemOffset = UNSAFE.objectFieldOffset |
518 |
|
(k.getDeclaredField("item")); |
519 |
|
nextOffset = UNSAFE.objectFieldOffset |
598 |
|
break; // unless slack < 2 |
599 |
|
} |
600 |
|
LockSupport.unpark(p.waiter); |
601 |
< |
return this.<E>cast(item); |
601 |
> |
return LinkedTransferQueue.<E>cast(item); |
602 |
|
} |
603 |
|
} |
604 |
|
Node n = p.next; |
676 |
|
if (item != e) { // matched |
677 |
|
// assert item != s; |
678 |
|
s.forgetContents(); // avoid garbage |
679 |
< |
return this.<E>cast(item); |
679 |
> |
return LinkedTransferQueue.<E>cast(item); |
680 |
|
} |
681 |
|
if ((w.isInterrupted() || (timed && nanos <= 0)) && |
682 |
|
s.casItem(e, s)) { // cancel |
757 |
|
Object item = p.item; |
758 |
|
if (p.isData) { |
759 |
|
if (item != null && item != p) |
760 |
< |
return this.<E>cast(item); |
760 |
> |
return LinkedTransferQueue.<E>cast(item); |
761 |
|
} |
762 |
|
else if (item == null) |
763 |
|
return null; |
1016 |
|
* return {@code false}. |
1017 |
|
* |
1018 |
|
* @return {@code true} (as specified by |
1019 |
< |
* {@link BlockingQueue#offer(Object,long,TimeUnit) BlockingQueue.offer}) |
1019 |
> |
* {@link java.util.concurrent.BlockingQueue#offer(Object,long,TimeUnit) |
1020 |
> |
* BlockingQueue.offer}) |
1021 |
|
* @throws NullPointerException if the specified element is null |
1022 |
|
*/ |
1023 |
|
public boolean offer(E e, long timeout, TimeUnit unit) { |
1260 |
|
* {@code LinkedTransferQueue} is not capacity constrained. |
1261 |
|
* |
1262 |
|
* @return {@code Integer.MAX_VALUE} (as specified by |
1263 |
< |
* {@link BlockingQueue#remainingCapacity()}) |
1263 |
> |
* {@link java.util.concurrent.BlockingQueue#remainingCapacity() |
1264 |
> |
* BlockingQueue.remainingCapacity}) |
1265 |
|
*/ |
1266 |
|
public int remainingCapacity() { |
1267 |
|
return Integer.MAX_VALUE; |
1310 |
|
static { |
1311 |
|
try { |
1312 |
|
UNSAFE = getUnsafe(); |
1313 |
< |
Class k = LinkedTransferQueue.class; |
1313 |
> |
Class<?> k = LinkedTransferQueue.class; |
1314 |
|
headOffset = UNSAFE.objectFieldOffset |
1315 |
|
(k.getDeclaredField("head")); |
1316 |
|
tailOffset = UNSAFE.objectFieldOffset |