Packages

t

akka.dispatch.forkjoin

TransferQueue

trait TransferQueue[E] extends BlockingQueue[E]

A BlockingQueue in which producers may wait for consumers to receive elements. A TransferQueue may be useful for example in message passing applications in which producers sometimes (using method #transfer) await receipt of elements by consumers invoking take or poll, while at other times enqueue elements (via method put) without waiting for receipt. Non-blocking and time-out versions of tryTransfer are also available. A TransferQueue may also be queried, via #hasWaitingConsumer, whether there are any threads waiting for items, which is a converse analogy to a peek operation.

Like other blocking queues, a TransferQueue may be capacity 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 SynchronousQueue, put and transfer are effectively synonymous.

This interface is a member of the Java Collections Framework.

Source
TransferQueue.java
Since

1.7

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TransferQueue
  2. BlockingQueue
  3. Queue
  4. Collection
  5. Iterable
  6. AnyRef
  7. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def add(arg0: E): Boolean
    Definition Classes
    BlockingQueue → Queue → Collection
  2. abstract def addAll(arg0: Collection[_ <: E]): Boolean
    Definition Classes
    Collection
  3. abstract def clear(): Unit
    Definition Classes
    Collection
  4. abstract def contains(arg0: Any): Boolean
    Definition Classes
    BlockingQueue → Collection
  5. abstract def containsAll(arg0: Collection[_]): Boolean
    Definition Classes
    Collection
  6. abstract def drainTo(arg0: Collection[_ >: E], arg1: Int): Int
    Definition Classes
    BlockingQueue
  7. abstract def drainTo(arg0: Collection[_ >: E]): Int
    Definition Classes
    BlockingQueue
  8. abstract def element(): E
    Definition Classes
    Queue
  9. abstract def getWaitingConsumerCount(): Int

    Returns an estimate of the number of consumers waiting to receive elements via #take or timed poll.

    Returns an estimate of the number of consumers waiting to receive elements via #take or timed poll. The return value is an approximation of a momentary state of affairs, that may be inaccurate if consumers have completed or given up waiting. The value may be useful for monitoring and heuristics, but not for synchronization control. Implementations of this method are likely to be noticeably slower than those for #hasWaitingConsumer.

    returns

    the number of consumers waiting to receive elements

  10. abstract def hasWaitingConsumer(): Boolean

    Returns true if there is at least one consumer waiting to receive an element via #take or timed poll.

    Returns true if there is at least one consumer waiting to receive an element via #take or timed poll. The return value represents a momentary state of affairs.

    returns

    true if there is at least one waiting consumer

  11. abstract def isEmpty(): Boolean
    Definition Classes
    Collection
  12. abstract def iterator(): Iterator[E]
    Definition Classes
    Collection → Iterable
  13. abstract def offer(arg0: E, arg1: Long, arg2: TimeUnit): Boolean
    Definition Classes
    BlockingQueue
    Annotations
    @throws( ... )
  14. abstract def offer(arg0: E): Boolean
    Definition Classes
    BlockingQueue → Queue
  15. abstract def peek(): E
    Definition Classes
    Queue
  16. abstract def poll(arg0: Long, arg1: TimeUnit): E
    Definition Classes
    BlockingQueue
    Annotations
    @throws( ... )
  17. abstract def poll(): E
    Definition Classes
    Queue
  18. abstract def put(arg0: E): Unit
    Definition Classes
    BlockingQueue
    Annotations
    @throws( ... )
  19. abstract def remainingCapacity(): Int
    Definition Classes
    BlockingQueue
  20. abstract def remove(arg0: Any): Boolean
    Definition Classes
    BlockingQueue → Collection
  21. abstract def remove(): E
    Definition Classes
    Queue
  22. abstract def removeAll(arg0: Collection[_]): Boolean
    Definition Classes
    Collection
  23. abstract def retainAll(arg0: Collection[_]): Boolean
    Definition Classes
    Collection
  24. abstract def size(): Int
    Definition Classes
    Collection
  25. abstract def take(): E
    Definition Classes
    BlockingQueue
    Annotations
    @throws( ... )
  26. abstract def toArray[T](arg0: Array[T]): Array[T]
    Definition Classes
    Collection
  27. abstract def toArray(): Array[AnyRef]
    Definition Classes
    Collection
  28. abstract def transfer(e: E): Unit

    Transfers the element to a consumer, waiting if necessary to do so.

    Transfers the element to a consumer, waiting if necessary to do so.

    More precisely, transfers the specified element immediately if there exists a consumer already waiting to receive it (in #take or timed poll), else waits until the element is received by a consumer.

    e

    the element to transfer

    Exceptions thrown

    ClassCastException if the class of the specified element prevents it from being added to this queue

    IllegalArgumentException if some property of the specified element prevents it from being added to this queue

    InterruptedException if interrupted while waiting, in which case the element is not left enqueued

    NullPointerException if the specified element is null

  29. abstract def tryTransfer(e: E, timeout: Long, unit: TimeUnit): Boolean

    Transfers the element to a consumer if it is possible to do so before the timeout elapses.

    Transfers the element to a consumer if it is possible to do so before the timeout elapses.

    More precisely, transfers the specified element immediately if there exists a consumer already waiting to receive it (in #take or timed poll), else waits until the element is received by a consumer, returning false if the specified wait time elapses before the element can be transferred.

    e

    the element to transfer

    timeout

    how long to wait before giving up, in units of unit

    unit

    a TimeUnit determining how to interpret the timeout parameter

    returns

    true if successful, or false if the specified waiting time elapses before completion, in which case the element is not left enqueued

    Exceptions thrown

    ClassCastException if the class of the specified element prevents it from being added to this queue

    IllegalArgumentException if some property of the specified element prevents it from being added to this queue

    InterruptedException if interrupted while waiting, in which case the element is not left enqueued

    NullPointerException if the specified element is null

  30. abstract def tryTransfer(e: E): Boolean

    Transfers the element to a waiting consumer immediately, if possible.

    Transfers the element to a waiting consumer immediately, if possible.

    More precisely, transfers the specified element immediately if there exists a consumer already waiting to receive it (in #take or timed poll), otherwise returning false without enqueuing the element.

    e

    the element to transfer

    returns

    true if the element was transferred, else false

    Exceptions thrown

    ClassCastException if the class of the specified element prevents it from being added to this queue

    IllegalArgumentException if some property of the specified element prevents it from being added to this queue

    NullPointerException if the specified element is null

Concrete Value Members

  1. def forEach(arg0: Consumer[_ >: E]): Unit
    Definition Classes
    Iterable
  2. def parallelStream(): Stream[E]
    Definition Classes
    Collection
  3. def removeIf(arg0: Predicate[_ >: E]): Boolean
    Definition Classes
    Collection
  4. def spliterator(): Spliterator[E]
    Definition Classes
    Collection → Iterable
  5. def stream(): Stream[E]
    Definition Classes
    Collection