524 |
|
/** |
525 |
|
* Transfers the specified element immediately if there exists a |
526 |
|
* consumer already waiting to receive it (in {@link #take} or |
527 |
< |
* timed {@link #poll(Object,long,TimeUnit) poll}), otherwise |
527 |
> |
* timed {@link #poll(long,TimeUnit) poll}), otherwise |
528 |
|
* returning {@code false} without enqueuing the element. |
529 |
|
* |
530 |
|
* @throws NullPointerException if the specified element is null |
539 |
|
* waiting if necessary for the element to be received by a |
540 |
|
* consumer invoking {@code take} or {@code poll}. |
541 |
|
* |
542 |
– |
* @throws InterruptedException {@inheritDoc} |
542 |
|
* @throws NullPointerException if the specified element is null |
543 |
|
*/ |
544 |
|
public void transfer(E e) throws InterruptedException { |
554 |
|
* waiting up to the specified wait time for the element to be |
555 |
|
* received by a consumer invoking {@code take} or {@code poll}. |
556 |
|
* |
558 |
– |
* @throws InterruptedException {@inheritDoc} |
557 |
|
* @throws NullPointerException if the specified element is null |
558 |
|
*/ |
559 |
|
public boolean tryTransfer(E e, long timeout, TimeUnit unit) |
574 |
|
throw new InterruptedException(); |
575 |
|
} |
576 |
|
|
579 |
– |
/** |
580 |
– |
* @throws InterruptedException {@inheritDoc} |
581 |
– |
*/ |
577 |
|
public E poll(long timeout, TimeUnit unit) throws InterruptedException { |
578 |
|
E e = xfer(null, TIMEOUT, unit.toNanos(timeout)); |
579 |
|
if (e != null || !Thread.interrupted()) |