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. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from TransferQueue[E] to any2stringadd[TransferQueue[E]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (TransferQueue[E], B)
    Implicit
    This member is added by an implicit conversion from TransferQueue[E] to ArrowAssoc[TransferQueue[E]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate() @throws( ... )
  8. def ensuring(cond: (TransferQueue[E]) ⇒ Boolean, msg: ⇒ Any): TransferQueue[E]
    Implicit
    This member is added by an implicit conversion from TransferQueue[E] to Ensuring[TransferQueue[E]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  9. def ensuring(cond: (TransferQueue[E]) ⇒ Boolean): TransferQueue[E]
    Implicit
    This member is added by an implicit conversion from TransferQueue[E] to Ensuring[TransferQueue[E]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  10. def ensuring(cond: Boolean, msg: ⇒ Any): TransferQueue[E]
    Implicit
    This member is added by an implicit conversion from TransferQueue[E] to Ensuring[TransferQueue[E]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: Boolean): TransferQueue[E]
    Implicit
    This member is added by an implicit conversion from TransferQueue[E] to Ensuring[TransferQueue[E]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  14. def forEach(arg0: Consumer[_ >: E]): Unit
    Definition Classes
    Iterable
  15. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from TransferQueue[E] to StringFormat[TransferQueue[E]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  16. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  17. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  21. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  22. def parallelStream(): Stream[E]
    Definition Classes
    Collection
  23. def removeIf(arg0: Predicate[_ >: E]): Boolean
    Definition Classes
    Collection
  24. def spliterator(): Spliterator[E]
    Definition Classes
    Collection → Iterable
  25. def stream(): Stream[E]
    Definition Classes
    Collection
  26. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  27. def toArray[T](arg0: IntFunction[Array[T]]): Array[T]
    Definition Classes
    Collection
  28. def toString(): String
    Definition Classes
    AnyRef → Any
  29. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  31. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. def [B](y: B): (TransferQueue[E], B)
    Implicit
    This member is added by an implicit conversion from TransferQueue[E] to ArrowAssoc[TransferQueue[E]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from BlockingQueue[E]

Inherited from Queue[E]

Inherited from Collection[E]

Inherited from Iterable[E]

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from TransferQueue[E] to any2stringadd[TransferQueue[E]]

Inherited by implicit conversion StringFormat from TransferQueue[E] to StringFormat[TransferQueue[E]]

Inherited by implicit conversion Ensuring from TransferQueue[E] to Ensuring[TransferQueue[E]]

Inherited by implicit conversion ArrowAssoc from TransferQueue[E] to ArrowAssoc[TransferQueue[E]]

Ungrouped