akka.dispatch

DefaultPromise

class DefaultPromise [T] extends AbstractPromise with Promise[T]

The default concrete Future implementation.

Self Type
DefaultPromise[T]
Linear Supertypes
Promise[T], Future[T], Awaitable[T], AbstractPromise, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. DefaultPromise
  2. Promise
  3. Future
  4. Awaitable
  5. AbstractPromise
  6. AnyRef
  7. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new DefaultPromise ()(implicit executor: ExecutionContext)

Type Members

  1. class FutureWithFilter [+A] extends AnyRef

    Attributes
    final

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 << (stream: PromiseStreamOut[T]): akka.dispatch.Future[T] @util.continuations.package.cps[akka.dispatch.Future[Any]]

    Attributes
    final
    Definition Classes
    Promise
  5. def << (other: Future[T]): akka.dispatch.Future[T] @util.continuations.package.cps[akka.dispatch.Future[Any]]

    Attributes
    final
    Definition Classes
    Promise
  6. def << (value: T): akka.dispatch.Future[T] @util.continuations.package.cps[akka.dispatch.Future[Any]]

    Attributes
    final
    Definition Classes
    Promise
  7. def == (arg0: AnyRef): Boolean

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

    Attributes
    final
    Definition Classes
    Any
  9. 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)
     }
    
    Definition Classes
    Future
  10. 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.

    Definition Classes
    Future
  11. def asInstanceOf [T0] : T0

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

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  13. def complete (value: Either[Throwable, T]): DefaultPromise.this.type

    Completes this Promise with the specified result, if not already completed.

    Completes this Promise with the specified result, if not already completed.

    returns

    this

    Attributes
    final
    Definition Classes
    Promise
  14. def completeWith (other: Future[T]): DefaultPromise.this.type

    Completes this Promise with the specified other Future, when that Future is completed, unless this Promise has already been completed.

    Completes this Promise with the specified other Future, when that Future is completed, unless this Promise has already been completed.

    returns

    this.

    Attributes
    final
    Definition Classes
    Promise
  15. def eq (arg0: AnyRef): Boolean

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

    Definition Classes
    AnyRef → Any
  17. implicit val executor : ExecutionContext

    Attributes
    implicit
    Definition Classes
    DefaultPromiseFuture
  18. 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
    Definition Classes
    Future
  19. def failure (exception: Throwable): DefaultPromise.this.type

    Completes this Promise with the specified exception, if not already completed.

    Completes this Promise with the specified exception, if not already completed.

    returns

    this

    Attributes
    final
    Definition Classes
    Promise
  20. 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.

    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.

    Definition Classes
    Future
  21. 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
    Definition Classes
    Future
  22. def finalize (): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  23. 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
    Definition Classes
    Future
  24. 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
    Definition Classes
    Future
  25. def future : Future[T]

    Returns the Future associated with this Promise

    Returns the Future associated with this Promise

    Definition Classes
    Promise
  26. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef → Any
  27. def getState : AnyRef

    Attributes
    protected final
    Annotations
    @inline()
  28. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  29. def isCompleted (): Boolean

    Tests whether this Future has been completed.

    Tests whether this Future has been completed.

    Definition Classes
    DefaultPromiseFuture
  30. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  31. 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
    Definition Classes
    Future
  32. 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
    Definition Classes
    Future
  33. def ne (arg0: AnyRef): Boolean

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

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

    Attributes
    final
    Definition Classes
    AnyRef
  36. def onComplete [U] (func: (Either[Throwable, T]) ⇒ U): DefaultPromise.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.

    Definition Classes
    DefaultPromiseFuture
  37. def onFailure [U] (pf: PartialFunction[Throwable, U]): DefaultPromise.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
    Definition Classes
    Future
  38. def onSuccess [U] (pf: PartialFunction[T, U]): DefaultPromise.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
    Definition Classes
    Future
  39. def ready (atMost: Duration)(implicit permit: CanAwait): DefaultPromise.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.

    Definition Classes
    DefaultPromiseAwaitable
    Annotations
    @throws( classOf[TimeoutException] )
  40. 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
    Definition Classes
    Future
  41. 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
    
    Definition Classes
    Future
  42. def resolve [X] (source: Either[Throwable, X]): Either[Throwable, X]

    Attributes
    protected final
    Definition Classes
    Future
  43. 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.

    Definition Classes
    DefaultPromiseAwaitable
    Annotations
    @throws( classOf[Exception] )
  44. def success (result: T): DefaultPromise.this.type

    Completes this Promise with the specified result, if not already completed.

    Completes this Promise with the specified result, if not already completed.

    returns

    this

    Attributes
    final
    Definition Classes
    Promise
  45. def synchronized [T0] (arg0: ⇒ T0): T0

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

    Definition Classes
    AnyRef → Any
  47. def tryAwait (atMost: Duration): Boolean

    Attributes
    protected final
  48. def tryComplete (value: Either[Throwable, T]): Boolean

    Completes this Promise with the specified result, if not already completed.

    Completes this Promise with the specified result, if not already completed.

    returns

    whether this call completed the Promise

    Definition Classes
    DefaultPromisePromise
  49. def updateState (oldState: AnyRef, newState: AnyRef): Boolean

    Attributes
    protected final
    Annotations
    @inline()
  50. 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.

    Definition Classes
    DefaultPromiseFuture
  51. def wait (): Unit

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

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

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

    Used by for-comprehensions

    Used by for-comprehensions

    Attributes
    final
    Definition Classes
    Future
  55. 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.

    Definition Classes
    Future

Inherited from Promise[T]

Inherited from Future[T]

Inherited from Awaitable[T]

Inherited from AbstractPromise

Inherited from AnyRef

Inherited from Any