akka.dispatch

Future

object Future extends AnyRef

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. Future
  2. AnyRef
  3. Any
Visibility
  1. Public
  2. All

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. def apply[T](body: ⇒ T)(implicit executor: ExecutionContext): Future[T]

    This method constructs and returns a Future that will eventually hold the result of the execution of the supplied body The execution is performed by the specified Dispatcher.

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def blocking(): Unit

    Signals that the current thread of execution will potentially engage an action that will take a non-trivial amount of time, perhaps by using blocking.

    Signals that the current thread of execution will potentially engage an action that will take a non-trivial amount of time, perhaps by using blocking.IO or using a lot of CPU time, giving the system a chance to spawn new threads, reuse old threads or otherwise, to prevent starvation and/or unfairness.

    Assures that any Future tasks initiated in the current thread will be executed asynchronously, including any tasks currently queued to be executed in the current thread. This is needed if the current task may block, causing delays in executing the remaining tasks which in some cases may cause a deadlock.

    Note: Calling 'Await.result(future)' or 'Await.ready(future)' will automatically trigger this method.

    For example, in the following block of code the call to 'latch.open' might not be executed until after the call to 'latch.await', causing a deadlock. By adding 'Future.blocking()' the call to 'latch.open' will instead be dispatched separately from the current block, allowing it to be run in parallel:

    val latch = new StandardLatch
    val future = Future() map { _ ⇒
      Future.blocking()
      val nested = Future()
      nested foreach (_ ⇒ latch.open)
      latch.await
    }
    

  9. def clone(): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  10. final def eq(arg0: AnyRef): Boolean

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

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

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  13. def find[T](futures: Traversable[Future[T]])(predicate: (T) ⇒ Boolean)(implicit executor: ExecutionContext): Future[Option[T]]

    Returns a Future that will hold the optional result of the first Future with a result that matches the predicate

  14. def firstCompletedOf[T](futures: Traversable[Future[T]])(implicit executor: ExecutionContext): Future[T]

    Returns a Future to the result of the first future in the list that is completed

  15. def flow[A](body: ⇒ A @util.continuations.package.cps[akka.dispatch.Future[Any]])(implicit executor: ExecutionContext): Future[A]

    Captures a block that will be transformed into 'Continuation Passing Style' using Scala's Delimited Continuations plugin.

    Captures a block that will be transformed into 'Continuation Passing Style' using Scala's Delimited Continuations plugin.

    Within the block, the result of a Future may be accessed by calling Future.apply. At that point execution is suspended with the rest of the block being stored in a continuation until the result of the Future is available. If an Exception is thrown while processing, it will be contained within the resulting Future.

    This allows working with Futures in an imperative style without blocking for each result.

    Completing a Future using 'Promise << Future' will also suspend execution until the value of the other Future is available.

    The Delimited Continuations compiler plugin must be enabled in order to use this method.

  16. def fold[T, R](futures: Traversable[Future[T]])(zero: R)(foldFun: (R, T) ⇒ R)(implicit executor: ExecutionContext): Future[R]

    A non-blocking fold over the specified futures, with the start value of the given zero.

    A non-blocking fold over the specified futures, with the start value of the given zero. The fold is performed on the thread where the last future is completed, the result will be the first failure of any of the futures, or any failure in the actual fold, or the result of the fold. Example:

      val result = Await.result(Future.fold(futures)(0)(_ + _), 5 seconds)
    

  17. final def getClass(): java.lang.Class[_]

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

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

    Definition Classes
    Any
  20. final def ne(arg0: AnyRef): Boolean

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

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

    Definition Classes
    AnyRef
  23. def reduce[T, R >: T](futures: Traversable[Future[T]])(op: (R, T) ⇒ R)(implicit executor: ExecutionContext): Future[R]

    Reduces the results of the supplied futures and binary operation.

    Reduces the results of the supplied futures and binary operation. Example:

      val result = Await.result(Futures.reduce(futures)(_ + _), 5 seconds)
    

  24. def sequence[A, M[_] <: Traversable[_]](in: M[Future[A]])(implicit cbf: CanBuildFrom[M[Future[A]], A, M[A]], executor: ExecutionContext): Future[M[A]]

    Simple version of Futures.

    Simple version of Futures.traverse. Transforms a Traversable[Future[A]] into a Future[Traversable[A]]. Useful for reducing many Futures into a single Future.

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

    Definition Classes
    AnyRef
  26. def toString(): String

    Definition Classes
    AnyRef → Any
  27. def traverse[A, B, M[_] <: Traversable[_]](in: M[A])(fn: (A) ⇒ Future[B])(implicit cbf: CanBuildFrom[M[A], B, M[B]], executor: ExecutionContext): Future[M[B]]

    Transforms a Traversable[A] into a Future[Traversable[B]] using the provided Function A ⇒ Future[B].

    Transforms a Traversable[A] into a Future[Traversable[B]] using the provided Function A ⇒ Future[B]. This is useful for performing a parallel map. For example, to apply a function to all items of a list in parallel:

    val myFutureList = Future.traverse(myList)(x ⇒ Future(myFunc(x)))
    

  28. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  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
    @throws()

Inherited from AnyRef

Inherited from Any