A {@link BlockingQueue} in which producers may wait for consumersto receive elements. A {@code TransferQueue} may be useful forexample in message passing applications in which producers sometimes (using method {@link #transfer}) await receipt of elements by consumers invoking {@code take} or {@code poll}, while at other times enqueue elements (via method {@code put}) without waiting for receipt. {@linkplain #tryTransfer(Object) Non-blocking} and{@linkplain #tryTransfer(Object,long,TimeUnit) time-out} versions of{@code tryTransfer} are also available.A {@code TransferQueue} may also be queried, via {@link #hasWaitingConsumer}, whether there are any threads waiting for items, which is a converse analogy to a {@code peek} operation.
Like other blocking queues, a {@code TransferQueue} may becapacity bounded. If so, an attempted transfer operation may initially block waiting for available space, and/or subsequently block waiting for reception by a consumer. Note that in a queue with zero capacity, such as {@link SynchronousQueue}, {@code put}and {@code transfer} are effectively synonymous.
This interface is a member of the Java Collections Framework.
@since 1.7
@author Doug Lea
@param < E> the type of elements held in this collection