akka.dispatch

Future

trait Future [+T] extends Awaitable[T]

Attributes
sealed
Linear Supertypes
Awaitable[T], AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. Future
  2. Awaitable
  3. AnyRef
  4. Any
Visibility
  1. Public
  2. All

Type Members

  1. class FutureWithFilter [+A] extends AnyRef

    Attributes
    final

Abstract Value Members

  1. implicit def executor : ExecutionContext

    Attributes
    protected implicit abstract
  2. def isCompleted : Boolean

    Tests whether this Future has been completed.

    Tests whether this Future has been completed.

    Attributes
    abstract
  3. def onComplete [U] (func: (Either[Throwable, T]) ⇒ U): Future.this.type

    When this Future is completed, apply the provided function to the Future.

    When this Future is completed, apply the provided function to the Future. If the Future has already been completed, this will apply immediately. Multiple callbacks may be registered; there is no guarantee that they will be executed in a particular order.

    Attributes
    abstract
  4. def ready (atMost: Duration)(implicit permit: CanAwait): Future.this.type

    Should throw java.util.concurrent.TimeoutException if times out This method should not be called directly.

    Should throw java.util.concurrent.TimeoutException if times out This method should not be called directly.

    Attributes
    abstract
    Definition Classes
    Awaitable
    Annotations
    @throws( classOf[TimeoutException] )
  5. def result (atMost: Duration)(implicit permit: CanAwait): T

    Throws exceptions if cannot produce a T within the specified time This method should not be called directly.

    Throws exceptions if cannot produce a T within the specified time This method should not be called directly.

    Attributes
    abstract
    Definition Classes
    Awaitable
    Annotations
    @throws( classOf[Exception] )
  6. def value : Option[Either[Throwable, T]]

    The contained value of this Future.

    The contained value of this Future. Before this Future is completed the value will be None. After completion the value will be Some(Right(t)) if it contains a valid result, or Some(Left(error)) if it contains an exception.

    Attributes
    abstract

Concrete Value Members

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

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

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

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

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

    Attributes
    final
    Definition Classes
    Any
  6. def andThen [U] (pf: PartialFunction[Either[Throwable, T], U]): Future[T]

    Returns a new Future that will contain the completed result of this Future, and which will invoke the supplied PartialFunction when completed.

    Returns a new Future that will contain the completed result of this Future, and which will invoke the supplied PartialFunction when completed.

    This allows for establishing order of side-effects.

     Future { 5 } andThen {
       case something => assert(something is awesome)
     } andThen {
       case Left(t) => handleProblem(t)
       case Right(v) => dealWithSuccess(v)
     }
    
  7. def apply (): T @util.continuations.package.cps[akka.dispatch.Future[Any]]

    For use only within a Future.

    For use only within a Future.flow block or another compatible Delimited Continuations reset block.

    Returns the result of this Future without blocking, by suspending execution and storing it as a continuation until the result is available.

  8. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  9. def clone (): AnyRef

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

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

    Definition Classes
    AnyRef → Any
  12. def failed : Future[Throwable]

    Returns a failure projection of this Future If this becomes completed with a failure, that failure will be the success of the returned Future If this becomes completed with a result, then the returned future will fail with a NoSuchElementException

    Returns a failure projection of this Future If this becomes completed with a failure, that failure will be the success of the returned Future If this becomes completed with a result, then the returned future will fail with a NoSuchElementException

    Attributes
    final
  13. def fallbackTo [U >: T] (that: Future[U]): Future[U]

    Returns a new Future that will either hold the successful value of this Future, or, it this Future fails, it will hold the result of "that" Future.

  14. def filter (pred: (T) ⇒ Boolean): Future[T]

    Returns a new Future that will hold the successful result of this Future if it matches the given predicate, if it doesn't match, the resulting Future will be a failed Future with a MatchError, of if this Future fails, that failure will be propagated to the returned Future

    Returns a new Future that will hold the successful result of this Future if it matches the given predicate, if it doesn't match, the resulting Future will be a failed Future with a MatchError, of if this Future fails, that failure will be propagated to the returned Future

    Attributes
    final
  15. def finalize (): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  16. def flatMap [A] (f: (T) ⇒ Future[A]): Future[A]

    Creates a new Future by applying a function to the successful result of this Future, and returns the result of the function as the new Future.

    Creates a new Future by applying a function to the successful result of this Future, and returns the result of the function as the new Future. If this Future is completed with an exception then the new Future will also contain this exception. Example:

    val future1 = for {
      a: Int    <- actor ? "Hello" // returns 5
      b: String <- actor ? a       // returns "10"
      c: String <- actor ? 7       // returns "14"
    } yield b + "-" + c
    

    Attributes
    final
  17. def foreach [U] (f: (T) ⇒ U): Unit

    Same as onSuccess { case r => f(r) } but is also used in for-comprehensions

    Same as onSuccess { case r => f(r) } but is also used in for-comprehensions

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

    Attributes
    final
    Definition Classes
    AnyRef → Any
  19. def hashCode (): Int

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

    Attributes
    final
    Definition Classes
    Any
  21. def map [A] (f: (T) ⇒ A): Future[A]

    Creates a new Future by applying a function to the successful result of this Future.

    Creates a new Future by applying a function to the successful result of this Future. If this Future is completed with an exception then the new Future will also contain this exception. Example:

    val future1 = for {
      a: Int    <- actor ? "Hello" // returns 5
      b: String <- actor ? a       // returns "10"
      c: String <- actor ? 7       // returns "14"
    } yield b + "-" + c
    

    Attributes
    final
  22. def mapTo [A] (implicit m: Manifest[A]): Future[A]

    Creates a new Future[A] which is completed with this Future's result if that conforms to A's erased type or a ClassCastException otherwise.

    Creates a new Future[A] which is completed with this Future's result if that conforms to A's erased type or a ClassCastException otherwise.

    When used from Java, to create the Manifest, use: import static akka.japi.Util.manifest; future.mapTo(manifest(MyClass.class));

    Attributes
    final
  23. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  24. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  25. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  26. def onFailure [U] (pf: PartialFunction[Throwable, U]): Future.this.type

    When the future is completed with an exception, apply the provided PartialFunction to the exception.

    When the future is completed with an exception, apply the provided PartialFunction to the exception. See onComplete for more details.

      future onFailure {
        case NumberFormatException ⇒ target ! "wrong format"
      }
    

    Attributes
    final
  27. def onSuccess [U] (pf: PartialFunction[T, U]): Future.this.type

    When the future is completed with a valid result, apply the provided PartialFunction to the result.

    When the future is completed with a valid result, apply the provided PartialFunction to the result. See onComplete for more details.

      future onSuccess {
        case Foo ⇒ target ! "foo"
        case Bar ⇒ target ! "bar"
      }
    

    Attributes
    final
  28. def recover [A >: T] (pf: PartialFunction[Throwable, A]): Future[A]

    Creates a new Future that will handle any matching Throwable that this Future might contain.

    Creates a new Future that will handle any matching Throwable that this Future might contain. If there is no match, or if this Future contains a valid result then the new Future will contain the same. Example:

    Future(6 / 0) recover { case e: ArithmeticException ⇒ 0 } // result: 0
    Future(6 / 0) recover { case e: NotFoundException   ⇒ 0 } // result: exception
    Future(6 / 2) recover { case e: ArithmeticException ⇒ 0 } // result: 3
    

    Attributes
    final
  29. def recoverWith [U >: T] (pf: PartialFunction[Throwable, Future[U]]): Future[U]

    Returns a new Future that will, in case this future fails, be completed with the resulting Future of the given PartialFunction, if the given PartialFunction matches the failure of the original Future.

    Returns a new Future that will, in case this future fails, be completed with the resulting Future of the given PartialFunction, if the given PartialFunction matches the failure of the original Future.

    If the PartialFunction throws, that Throwable will be propagated to the returned Future.

    Example:

     val f = Future { Int.MaxValue }
     Future (6 / 0) recoverWith { case e: ArithmeticException => f } // result: Int.MaxValue
    
  30. def resolve [X] (source: Either[Throwable, X]): Either[Throwable, X]

    Attributes
    protected final
  31. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  32. def toString (): String

    Definition Classes
    AnyRef → Any
  33. def wait (): Unit

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

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

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  36. def withFilter (p: (T) ⇒ Boolean): FutureWithFilter[T]

    Used by for-comprehensions

    Used by for-comprehensions

    Attributes
    final
  37. def zip [U] (that: Future[U]): Future[(T, U)]

    returns

    a new Future that will contain a tuple containing the successful result of this and that Future. If this or that fail, they will race to complete the returned Future with their failure. The returned Future will not be completed if neither this nor that are completed.

Inherited from Awaitable[T]

Inherited from AnyRef

Inherited from Any