373 |
|
} |
374 |
|
|
375 |
|
final boolean casItem(Object cmp, Object val) { |
376 |
< |
assert cmp.getClass() != Node.class; |
376 |
> |
assert cmp == null || cmp.getClass() != Node.class; |
377 |
|
return UNSAFE.compareAndSwapObject(this, itemOffset, cmp, val); |
378 |
|
} |
379 |
|
|
410 |
|
*/ |
411 |
|
final boolean isMatched() { |
412 |
|
Object x = item; |
413 |
< |
return x == this || (x != null) != isData; |
413 |
> |
return (x == this) || ((x == null) == isData); |
414 |
|
} |
415 |
|
|
416 |
|
/** |
479 |
|
private static final int SYNC = 2; // for transfer, take |
480 |
|
private static final int TIMEOUT = 3; // for timed poll, tryTransfer |
481 |
|
|
482 |
+ |
@SuppressWarnings("unchecked") |
483 |
+ |
static <E> E cast(Object item) { |
484 |
+ |
assert item == null || item.getClass() != Node.class; |
485 |
+ |
return (E) item; |
486 |
+ |
} |
487 |
+ |
|
488 |
|
/** |
489 |
|
* Implements all queuing methods. See above for explanation. |
490 |
|
* |
689 |
|
return null; |
690 |
|
} |
691 |
|
|
686 |
– |
@SuppressWarnings("unchecked") |
687 |
– |
static <E> E cast(Object item) { |
688 |
– |
assert item.getClass() != Node.class; |
689 |
– |
return (E) item; |
690 |
– |
} |
691 |
– |
|
692 |
|
/** |
693 |
|
* Returns the item in the first unmatched node with isData; or |
694 |
|
* null if none. Used by peek. |