play.api.libs.iteratee

Concurrent

object Concurrent

Utilities for concurrent usage of iteratees, enumerators and enumeratees.

Source
Concurrent.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Concurrent
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. trait Broadcaster extends AnyRef

    A broadcaster.

  2. trait Channel[E] extends AnyRef

    A channel for imperative style feeding of input into one or more iteratees.

  3. trait PatchPanel[E] extends AnyRef

    Allows patching in enumerators to an iteratee.

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def broadcast[E](e: Enumerator[E], interestIsDownToZero: (Broadcaster) ⇒ Unit = _ => ())(implicit ec: ExecutionContext): (Enumerator[E], Broadcaster)

    Create a broadcaster from the given enumerator.

    Create a broadcaster from the given enumerator. This allows iteratees to attach (and unattach by returning a done state) to a single enumerator. Iteratees will only receive input sent from the enumerator after they have attached to the broadcasting enumerator.

    e

    The enumerator to broadcast

    interestIsDownToZero

    Function that is invoked when all iteratees are done. May be invoked multiple times.

    ec

    The context to execute the supplied function with. The context is prepared on the calling thread before being used.

    returns

    A tuple of the broadcasting enumerator, that can be applied to each iteratee that wants to receive the input, and the broadcaster.

  8. def broadcast[E]: (Enumerator[E], Channel[E])

    Create an enumerator and channel for broadcasting input to many iteratees.

    Create an enumerator and channel for broadcasting input to many iteratees.

    This is intended for imperative style push input feeding into iteratees. For example:

    val (chatEnumerator, chatChannel) = Concurrent.broadcast[String]
    val chatClient1 = Iteratee.foreach[String](m => println("Client 1: " + m))
    val chatClient2 = Iteratee.foreach[String](m => println("Client 2: " + m))
    chatEnumerator |>>> chatClient1
    chatEnumerator |>>> chatClient2
    
    chatChannel.push(Message("Hello world!"))
  9. def buffer[E](maxBuffer: Int, length: (Input[E]) ⇒ Int)(implicit ec: ExecutionContext): Enumeratee[E, E]

    A buffering enumeratee.

    A buffering enumeratee.

    Maintains a buffer of maximum size maxBuffer, consuming as much of the input as the buffer will allow as quickly as it comes, while allowing the iteratee it feeds to consume it as slowly as it likes.

    This is useful in situations where the enumerator holds expensive resources open, while the iteratee may be slow, for example if the enumerator is a database result set that holds a transaction open, but the result set is being serialised and fed directly to an HTTP response.

    maxBuffer

    The maximum size to buffer. The size is computed using the given length function.

    length

    A function that computes the length of an input item

    ec

    The context to execute the supplied function with. The context is prepared on the calling thread before being used.

  10. def buffer[E](maxBuffer: Int): Enumeratee[E, E]

    A buffering enumeratee.

    A buffering enumeratee.

    Maintains a buffer of maximum size maxBuffer, consuming as much of the input as the buffer will allow as quickly as it comes, while allowing the iteratee it feeds to consume it as slowly as it likes.

    This is useful in situations where the enumerator holds expensive resources open, while the iteratee may be slow, for example if the enumerator is a database result set that holds a transaction open, but the result set is being serialised and fed directly to an HTTP response.

    maxBuffer

    The maximum number of items to buffer

  11. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  12. def dropInputIfNotReady[E](duration: Long, unit: TimeUnit = ...): Enumeratee[E, E]

    An enumeratee that consumes all input immediately, and passes it to the iteratee only if the iteratee is ready to handle it within the given timeout, otherwise it drops it.

    An enumeratee that consumes all input immediately, and passes it to the iteratee only if the iteratee is ready to handle it within the given timeout, otherwise it drops it.

    duration

    The time to wait for the iteratee to be ready

    unit

    The timeunit

  13. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  15. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  17. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  18. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  19. def joined[A]: (Iteratee[A, Unit], Enumerator[A])

    Create a joined iteratee enumerator pair.

    Create a joined iteratee enumerator pair.

    When the enumerator is applied to an iteratee, the iteratee subsequently consumes whatever the iteratee in the pair is applied to. Consequently the enumerator is "one shot", applying it to subsequent iteratees will throw an exception.

  20. def lazyAndErrIfNotReady[E](timeout: Long, unit: TimeUnit = TimeUnit.MILLISECONDS): Enumeratee[E, E]

    Enumeratee that times out if the iteratee it feeds to takes too long to consume available input.

    Enumeratee that times out if the iteratee it feeds to takes too long to consume available input.

    timeout

    The timeout period

    unit

    the time unit

  21. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  22. final def notify(): Unit

    Definition Classes
    AnyRef
  23. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  24. def patchPanel[E](patcher: (PatchPanel[E]) ⇒ Unit)(implicit ec: ExecutionContext): Enumerator[E]

    An enumerator that allows patching in enumerators to supply it with input.

    An enumerator that allows patching in enumerators to supply it with input.

    patcher

    A function that passes a patch panel whenever the enumerator is applied to an iteratee.

    ec

    The context to execute the supplied function with. The context is prepared on the calling thread before being used.

  25. def runPartial[E, A](enumerator: Enumerator[E], iteratee: Iteratee[E, A]): Future[(A, Enumerator[E])]

    Run the enumerator, and produce the remaining enumerator as part the result.

    Run the enumerator, and produce the remaining enumerator as part the result.

    The result will be the result of the iteratee, and an enumerator containing the remaining input.

  26. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  27. def toString(): String

    Definition Classes
    AnyRef → Any
  28. def unicast[E](onStart: (Channel[E]) ⇒ Unit, onComplete: ⇒ Unit = (), onError: (String, Input[E]) ⇒ Unit = (_: String, _: Input[E]) => ())(implicit ec: ExecutionContext): Enumerator[E] { val pec: scala.concurrent.ExecutionContext }

    Create an enumerator that allows imperative style pushing of input into a single iteratee.

    Create an enumerator that allows imperative style pushing of input into a single iteratee.

    The enumerator may be used multiple times, each time will cause a new invocation of onStart, which will pass a play.api.libs.iteratee.Concurrent.Channel that can be used to feed input into the iteratee. However, note that there is no way for the caller to know which iteratee is finished or encountered an error in the onComplete or onError functions.

    onStart

    Called when an enumerator is applied to an iteratee, providing the channel to feed input into that iteratee.

    onComplete

    Called when an iteratee is done.

    onError

    Called when an iteratee encounters an error, supplying the error and the input that caused the error.

    ec

    The context to execute the supplied functions with. The context is prepared on the calling thread before being used.

  29. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped