Packages

class Response[T] extends AnyRef

Typical interaction, given a predicate <user-input>, a function <display>, and an exception handler <handle>:

val TIMEOUT = 100 // (milliseconds) or something like that val r = new Response() while (!r.isComplete && !r.isCancelled) { if (<user-input>) r.cancel() else r.get(TIMEOUT) match { case Some(Left(data)) => <display>(data) case Some(Right(exc)) => <handle>(exc) case None => } }

Source
Response.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Response
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Response()

Value Members

  1. def cancel(): Unit

    Cancel action computing this response (Only the party that calls get on a response may cancel).

  2. def clear(): Unit
  3. def get(timeout: Long): Option[Either[T, Throwable]]

    Optionally get data within timeout milliseconds.

    Optionally get data within timeout milliseconds. When interrupted will return with Some(Right(InterruptedException)) When timeout ends, will return last stored provisional result, or else None if no provisional result was stored.

  4. def get: Either[T, Throwable]

    Get final data, wait as long as necessary.

    Get final data, wait as long as necessary. When interrupted will return with Right(InterruptedException)

  5. def isCancelled: Boolean

    A cancel request for this response has been issued

  6. def isComplete: Boolean

    Final data set was stored

  7. def raise(exc: Throwable): Unit

    Store raised exception in data, and mark response as complete.

  8. def set(x: T): Unit

    Set final data, and mark response as complete.

  9. def setProvisionally(x: T): Unit

    Set provisional data, more to come