Packages

class NoFuture extends Future[Nothing]

A Future which can never be satisfied and is thus always in the pending state.

See also

Future.never for an instance of it.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. NoFuture
  2. Future
  3. Awaitable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new NoFuture()

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def addEventListener(listener: FutureEventListener[_]): Future[Nothing]

    Register a FutureEventListener to be invoked when the computation completes.

    Register a FutureEventListener to be invoked when the computation completes. This method is typically used by Java programs because it avoids the use of small Function objects.

    Definition Classes
    Future
    Note

    this should be used for side-effects

    See also

    respond for a Scala API.

    transformedBy for a Java friendly way to produce a new Future from the result of a computation.

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def before[B](f: => Future[B])(implicit ev: <:<[NoFuture.this.type, Future[Unit]]): Future[B]

    Sequentially compose this with f.

    Sequentially compose this with f. This is as flatMap, but discards the result of this. Note that this applies only Unit-valued Futures — i.e. side-effects.

    Definition Classes
    Future
  7. def by(timer: Timer, when: Time, exc: => Throwable): Future[Nothing]

    Returns a new Future that fails if it is not satisfied before the given time.

    Returns a new Future that fails if it is not satisfied before the given time.

    Note: On timeout, the underlying future is not interrupted.

    Note: Interrupting a returned future would not prevent it from being satisfied with a given exception (when the time comes).

    timer

    to run timeout on.

    when

    indicates when to stop waiting for the result to be available.

    exc

    exception to throw.

    Definition Classes
    Future
  8. def by(timer: Timer, when: Time): Future[Nothing]

    Returns a new Future that fails if it is not satisfied before the given time.

    Returns a new Future that fails if it is not satisfied before the given time.

    Note: On timeout, the underlying future is not interrupted.

    Definition Classes
    Future
  9. def by(when: Time)(implicit timer: Timer): Future[Nothing]

    Returns a new Future that fails if it is not satisfied before the given time.

    Returns a new Future that fails if it is not satisfied before the given time.

    Same as the other by, but with an implicit timer. Sometimes this is more convenient.

    Note: On timeout, the underlying future is not interrupted.

    Definition Classes
    Future
  10. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  11. def delayed(howlong: Duration)(implicit timer: Timer): Future[Nothing]

    Delay the completion of this Future for at least howlong from now.

    Delay the completion of this Future for at least howlong from now.

    Note: Interrupting a returned future would not prevent it from becoming this future (when the time comes).

    Definition Classes
    Future
  12. def ensure(f: => Unit): Future[Nothing]

    Invoked regardless of whether the computation completed successfully or unsuccessfully.

    Invoked regardless of whether the computation completed successfully or unsuccessfully. Implemented in terms of respond so that subclasses control evaluation order. Returns a chained Future.

    The returned Future will be satisfied when this, the original future, is done.

    f

    the side-effect to apply when the computation completes.

    Definition Classes
    Future
    Example:
    1. import com.twitter.util.Future
      def callbacks(result: Future[Int]): Future[Int] =
        result.onSuccess { i =>
          println(i)
        }.onFailure { e =>
          println(e.getMessage)
        }.ensure {
          println("always printed")
        }
      val a = Future.value(1)
      callbacks(a) // prints "1" and then "always printed"
    Note

    this should be used for side-effects.

    See also

    respond if you need the result of the computation for usage in the side-effect.

  13. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  15. def filter(p: (Nothing) => Boolean): Future[Nothing]
    Definition Classes
    Future
  16. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  17. def flatMap[B](f: (Nothing) => Future[B]): Future[B]

    If this, the original future, succeeds, run f on the result.

    If this, the original future, succeeds, run f on the result.

    The returned result is a Future that is satisfied when the original future and the callback, f, are done.

    Definition Classes
    Future
    Examples:
    1. import com.twitter.util.{Await, Future}
      val f: Future[Int] = Future.value(1)
      val newf: Future[Int] = f.flatMap { x =>
        Future.value(x + 10)
      }
      Await.result(newf) // 11
      
      // Await.result blocks the current thread,
      // don't use it except for tests.

      If the original future fails, this one will also fail, without executing f and preserving the failed computation of this

    2. ,
    3. import com.twitter.util.{Await, Future}
      val f: Future[Int] = Future.exception(new Exception("boom!"))
      val newf: Future[Int] = f.flatMap { x =>
        println("I'm being executed") // won't print
        Future.value(x + 10)
      }
      Await.result(newf) // throws java.lang.Exception: boom!
    See also

    map

  18. def flatten[B](implicit ev: <:<[Nothing, Future[B]]): Future[B]

    Converts a Future[Future[B]] into a Future[B].

    Converts a Future[Future[B]] into a Future[B].

    Definition Classes
    Future
  19. def foreach(k: (Nothing) => Unit): Future[Nothing]

    Invoke the callback only if the Future returns successfully.

    Invoke the callback only if the Future returns successfully. Useful for Scala for comprehensions. Use onSuccess instead of this method for more readable code.

    Definition Classes
    Future
    See also

    onSuccess

  20. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  21. def handle[B >: Nothing](rescueException: PartialFunction[Throwable, B]): Future[B]

    If this, the original future, results in an exceptional computation, rescueException may convert the failure into a new result.

    If this, the original future, results in an exceptional computation, rescueException may convert the failure into a new result.

    The returned result is a Future that is satisfied when the original future and the callback, rescueException, are done.

    This is the equivalent of map for failed computations.

    Definition Classes
    Future
    Example:
    1. import com.twitter.util.{Await, Future}
      val f1: Future[Int] = Future.exception(new Exception("boom1!"))
      val f2: Future[Int] = Future.exception(new Exception("boom2!"))
      val newf: Future[Int] => Future[Int] = x => x.handle {
      	case e: Exception if e.getMessage == "boom1!" => 1
      }
      Await.result(newf(f1)) // 1
      Await.result(newf(f2)) // throws java.lang.Exception: boom2!
      
      // Await.result blocks the current thread,
      // don't use it except for tests.
    See also

    rescue

  22. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  23. def interruptible(): Future[Nothing]

    Makes a derivative Future which will be satisfied with the result of the parent.

    Makes a derivative Future which will be satisfied with the result of the parent. However, if it's interrupted, it will detach from the parent Future, satisfy itself with the exception raised to it, and won't propagate the interruption back to the parent Future.

    This is useful for when a Future is shared between many contexts, where it may not be useful to discard the underlying computation if just one context is no longer interested in the result. In particular, this is different from Future.masked in that it will prevent memory leaks if the parent Future will never be satisfied, because closures that are attached to this derivative Future will not be held onto by the killer Future.

    Definition Classes
    Future
    See also

    raise

    mask

    masked

  24. def isDefined: Boolean

    Is the result of the Future available yet?

    Is the result of the Future available yet?

    Definition Classes
    Future
  25. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  26. def isReady(implicit permit: CanAwait): Boolean

    Is this Awaitable ready? In other words: would calling Awaitable.ready block?

    Is this Awaitable ready? In other words: would calling Awaitable.ready block?

    Definition Classes
    NoFutureAwaitable
  27. def join[B](other: Future[B]): Future[(Nothing, B)]

    Joins this future with a given other future into a Future[(A, B)] (future of a Tuple2).

    Joins this future with a given other future into a Future[(A, B)] (future of a Tuple2). If this or other future fails, the returned Future is immediately satisfied by that failure.

    Definition Classes
    Future
  28. def joinWith[B, C](other: Future[B])(fn: (Nothing, B) => C): Future[C]

    Joins this future with a given other future and applies fn to its result.

    Joins this future with a given other future and applies fn to its result. If this or other future fails, the returned Future is immediately satisfied by that failure.

    Before (using join):

    val ab = a.join(b).map { case (a, b) => Foo(a, b) }

    After (using joinWith):

    val ab = a.joinWith(b)(Foo.apply)
    Definition Classes
    Future
  29. def liftToTry: Future[Try[Nothing]]

    Returns the result of the computation as a Future[Try[A]].

    Returns the result of the computation as a Future[Try[A]].

    Definition Classes
    Future
    Example:
    1. import com.twitter.util.{Await, Future, Try}
      val fr: Future[Int] = Future.value(1)
      val ft: Future[Int] = Future.exception(new Exception("boom!"))
      val r: Future[Try[Int]] = fr.liftToTry
      val t: Future[Try[Int]] = ft.liftToTry
      Await.result(r) // Return(1)
      Await.result(t) // Throw(java.lang.Exception: boom!)
      
      // Await.result blocks the current thread,
      // don't use it except for tests.
  30. def lowerFromTry[B](implicit ev: <:<[Nothing, Try[B]]): Future[B]

    Lowers a Future[Try[T]] into a Future[T].

    Lowers a Future[Try[T]] into a Future[T].

    Definition Classes
    Future
    Example:
    1. import com.twitter.util.{Await, Future, Return, Throw, Try}
      val fr: Future[Try[Int]] = Future.value(Return(1))
      val ft: Future[Try[Int]] = Future.value(Throw(new Exception("boom!")))
      val r: Future[Int] = fr.lowerFromTry
      val t: Future[Int] = ft.lowerFromTry
      Await.result(r) // 1
      Await.result(t) // throws java.lang.Exception: boom!
      
      // Await.result blocks the current thread,
      // don't use it except for tests.
  31. def map[B](f: (Nothing) => B): Future[B]

    If this, the original future, succeeds, run f on the result.

    If this, the original future, succeeds, run f on the result.

    The returned result is a Future that is satisfied when the original future and the callback, f, are done.

    Definition Classes
    Future
    Examples:
    1. import com.twitter.util.{Await, Future}
      val f: Future[Int] = Future.value(1)
      val newf: Future[Int] = f.map { x =>
        x + 10
      }
      Await.result(newf) // 11
      
      // Await.result blocks the current thread,
      // don't use it except for tests.

      If the original future fails, this one will also fail, without executing f and preserving the failed computation of this

    2. ,
    3. import com.twitter.util.{Await, Future}
      val f: Future[Int] = Future.exception(new Exception("boom!"))
      val newf: Future[Int] = f.map { x =>
        println("I'm being executed") // won't print
        x + 10
      }
      Await.result(newf) // throws java.lang.Exception: boom!
    See also

    flatMap for computations that return Futures.

    onSuccess for side-effecting chained computations.

  32. def mask(pred: PartialFunction[Throwable, Boolean]): Future[Nothing]

    Returns an identical Future except that it ignores interrupts which match a predicate.

    Returns an identical Future except that it ignores interrupts which match a predicate.

    This means that a Promise's interrupt handler will not execute on calls to Future.raise for inputs to pred that evaluate to true. Also, raise will not be forwarded to chained Futures.

    For example:

    val p = new Promise[Int]()
    p.setInterruptHandler { case x => println(s"interrupt handler for ${x.getClass}") }
    val f1: Future[Int] = p.mask {
      case _: IllegalArgumentException => true
    }
    f1.raise(new IllegalArgumentException("ignored!")) // nothing will be printed
    f1.map(_ + 1).raise(new IllegalArgumentException("ignored!")) // nothing will be printed
    
    val f2: Future[Int] = p.mask {
      case _: IllegalArgumentException => true
    }
    f2.raise(new Exception("fire!")) // will print "interrupt handler for class java.lang.Exception"
    Definition Classes
    Future
    See also

    raise

    masked

    interruptible

  33. def masked: Future[Nothing]

    Returns an identical Future that ignores all interrupts.

    Returns an identical Future that ignores all interrupts.

    This means that a Promise's interrupt handler will not execute for any call to Future.raise. Also, raise will not be forwarded to chained Futures.

    For example:

    import com.twitter.util.{Future, Promise}
    val p = new Promise[Int]()
    p.setInterruptHandler { case _ => println("interrupt handler") }
    
    val f: Future[Int] = p.masked
    f.raise(new Exception("ignored!")) // nothing will be printed
    f1.map(_ + 1).raise(new Exception("ignored!")) // nothing will be printed
    Definition Classes
    Future
    See also

    raise

    mask

    interruptible

  34. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  35. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  36. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  37. def onFailure(fn: (Throwable) => Unit): Future[Nothing]

    Invoke the function on the error, if the computation was unsuccessful.

    Invoke the function on the error, if the computation was unsuccessful. Returns a chained Future as in respond.

    returns

    chained Future

    Definition Classes
    Future
    Example:
    1. import com.twitter.util.Future
      def callbacks(result: Future[Int]): Future[Int] =
        result.onSuccess { i =>
          println(i)
        }.onFailure { e =>
          println(e.getMessage)
        }.ensure {
          println("always printed")
        }
      val b = Future.exception(new Exception("boom!"))
      callbacks(b) // prints "boom!" and then "always printed"
    Note

    this should be used for side-effects.

    ,

    if fn is a PartialFunction and the input is not defined for a given Throwable, the resulting MatchError will propagate to the current Monitor. This will happen if you use a construct such as future.onFailure { case NonFatal(e) => ... } when the Throwable is "fatal".

    See also

    handle and rescue to produce a new Future from the result of the computation.

  38. def onSuccess(f: (Nothing) => Unit): Future[Nothing]

    Invoke the function on the result, if the computation was successful.

    Invoke the function on the result, if the computation was successful. Returns a chained Future as in respond.

    returns

    chained Future

    Definition Classes
    Future
    Example:
    1. import com.twitter.util.Future
      def callbacks(result: Future[Int]): Future[Int] =
        result.onSuccess { i =>
          println(i)
        }.onFailure { e =>
          println(e.getMessage)
        }.ensure {
          println("always printed")
        }
      val a = Future.value(1)
      callbacks(a) // prints "1" and then "always printed"
    Note

    this should be used for side-effects.

    See also

    flatMap and map to produce a new Future from the result of the computation.

  39. def or[U >: Nothing](other: Future[U]): Future[U]

    A synonym for select: Choose the first Future to be satisfied.

    A synonym for select: Choose the first Future to be satisfied.

    Definition Classes
    Future
  40. def poll: Option[Try[Nothing]]

    Polls for an available result.

    Polls for an available result. If the Future has been satisfied, returns Some(result), otherwise None.

    Definition Classes
    NoFutureFuture
  41. def proxyTo[B >: Nothing](other: Promise[B]): Unit

    Send updates from this Future to the other.

    Send updates from this Future to the other. other must not yet be satisfied at the time of the call. After this call, nobody else should satisfy other.

    Definition Classes
    Future
    Note

    using proxyTo will mask interrupts to this future, and it's the user's responsibility to set an interrupt handler on other to raise on f. In some cases, using com.twitter.util.Promise.become may be more appropriate.

    See also

    com.twitter.util.Promise.become

  42. def raise(interrupt: Throwable): Unit

    Raise the given throwable as an interrupt.

    Raise the given throwable as an interrupt. Interrupts are one-shot and latest-interrupt wins. That is, the last interrupt to have been raised is delivered exactly once to the Promise responsible for making progress on the future (multiple such promises may be involved in flatMap chains).

    Raising an interrupt does not alter the externally observable state of the Future. They are used to signal to the producer of the future's value that the result is no longer desired (for whatever reason given in the passed Throwable). For example:

    import com.twitter.util.Promise
    val p = new Promise[Unit]()
    p.setInterruptHandler { case _ => println("interrupt handler fired") }
    p.poll // is `None`
    p.raise(new Exception("raised!"))
    p.poll // is still `None`

    In the context of a Future created via composition (e.g. flatMap/onSuccess/transform), raise-ing on that Future will call raise on the head of the chain which created this Future. For example:

    import com.twitter.util.Promise
    val p = new Promise[Int]()
    p.setInterruptHandler { case _ => println("interrupt handler fired") }
    val f = p.map(_ + 1)
    
    f.raise(new Exception("fire!"))

    The call to f.raise will call p.raise and print "interrupt handler fired".

    When the head of that chain of Futures is satisfied, the next Future in the chain created by composition will have raise called. For example:

    import com.twitter.util.Promise
    val p1, p2 = new Promise[Int]()
    p1.setInterruptHandler { case _ => println("p1 interrupt handler") }
    p2.setInterruptHandler { case _ => println("p2 interrupt handler") }
    val f = p1.flatMap { _ => p2 }
    
    f.raise(new Exception("fire!")) // will print "p1 interrupt handler"
    p1.setValue(1) // will print "p2 interrupt handler"
    Definition Classes
    NoFutureFuture
    See also

    Promise.setInterruptHandler

  43. def raiseWithin(timer: Timer, timeout: Duration, exc: => Throwable): Future[Nothing]

    Returns a new Future that fails if this Future does not return in time.

    Returns a new Future that fails if this Future does not return in time.

    Note: On timeout, the underlying future is interrupted.

    Definition Classes
    Future
  44. def raiseWithin(timeout: Duration, exc: => Throwable)(implicit timer: Timer): Future[Nothing]

    Returns a new Future that fails if this Future does not return in time.

    Returns a new Future that fails if this Future does not return in time.

    Same as the other raiseWithin, but with an implicit timer. Sometimes this is more convenient.

    Note: On timeout, the underlying future is interrupted.

    Definition Classes
    Future
  45. def raiseWithin(timeout: Duration)(implicit timer: Timer): Future[Nothing]

    Returns a new Future that fails if this Future does not return in time.

    Returns a new Future that fails if this Future does not return in time.

    Same as the other raiseWithin, but with an implicit timer. Sometimes this is more convenient.

    Note: On timeout, the underlying future is interrupted.

    Definition Classes
    Future
  46. def ready(timeout: Duration)(implicit permit: CanAwait): NoFuture.this.type

    Support for Await.ready.

    Support for Await.ready. The use of the implicit permit is an access control mechanism: only Await.ready may call this method.

    Definition Classes
    NoFutureAwaitable
    Annotations
    @throws(classOf[TimeoutException]) @throws(classOf[InterruptedException])
  47. def rescue[B >: Nothing](rescueException: PartialFunction[Throwable, Future[B]]): Future[B]

    If this, the original future, results in an exceptional computation, rescueException may convert the failure into a new result.

    If this, the original future, results in an exceptional computation, rescueException may convert the failure into a new result.

    The returned result is a Future that is satisfied when the original future and the callback, rescueException, are done.

    This is the equivalent of flatMap for failed computations.

    Definition Classes
    Future
    Example:
    1. import com.twitter.util.{Await, Future}
      val f1: Future[Int] = Future.exception(new Exception("boom1!"))
      val f2: Future[Int] = Future.exception(new Exception("boom2!"))
      val newf: Future[Int] => Future[Int] = x => x.rescue {
      	case e: Exception if e.getMessage == "boom1!" => Future.value(1)
      }
      Await.result(newf(f1)) // 1
      Await.result(newf(f2)) // throws java.lang.Exception: boom2!
      
      // Await.result blocks the current thread,
      // don't use it except for tests.
    See also

    handle

  48. def respond(k: (Try[Nothing]) => Unit): Future[Nothing]

    When the computation completes, invoke the given callback function.

    When the computation completes, invoke the given callback function.

    The returned Future will be satisfied when this, the original future, is done.

    This method is most useful for very generic code (like libraries). Otherwise, it is a best practice to use one of the alternatives (onSuccess, onFailure, etc.).

    k

    the side-effect to apply when the computation completes. The value of the input to k will be the result of the computation to this future.

    returns

    a chained Future[A]

    Definition Classes
    NoFutureFuture
    Example:
    1. import com.twitter.util.{Await, Future, Return, Throw}
      val f1: Future[Int] = Future.value(1)
      val f2: Future[Int] = Future.exception(new Exception("boom!"))
      val printing: Future[Int] => Future[Int] = x => x.respond {
      	case Return(_) => println("Here's a Return")
      	case Throw(_) => println("Here's an Exception")
      }
      Await.result(printing(f1))
      // Prints side-effect "Here's a Return" and then returns Future value "1"
      Await.result(printing(f2))
      // Prints side-effect "Here's an Exception" and then throws java.lang.Exception: boom!
      
      // Await.result blocks the current thread,
      // don't use it except for tests.
    Note

    this should be used for side-effects.

    See also

    transform to produce a new Future from the result of the computation.

    ensure if you are not interested in the result of the computation.

    addEventListener for a Java friendly API.

  49. def result(timeout: Duration)(implicit permit: CanAwait): Nothing

    Support for Await.result.

    Support for Await.result. The use of the implicit permit is an access control mechanism: only Await.result may call this method.

    Definition Classes
    NoFutureAwaitable
    Annotations
    @throws(classOf[Exception])
  50. def select[U >: Nothing](other: Future[U]): Future[U]

    Choose the first Future to be satisfied.

    Choose the first Future to be satisfied.

    other

    another Future

    returns

    a new Future whose result is that of the first of this and other to return

    Definition Classes
    Future
  51. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  52. def toCompletableFuture[B >: Nothing]: CompletableFuture[B]

    Convert a Twitter Future to a Java native CompletableFuture.

    Convert a Twitter Future to a Java native CompletableFuture. This should match the semantics of a Java Future as closely as possible to avoid issues with the way another API might use them. At the same time, its semantics should be similar to those of a Twitter Future, so it propagates cancellation. See:

    https://download.oracle.com/javase/6/docs/api/java/util/concurrent/Future.html#cancel(boolean)

    Definition Classes
    Future
  53. def toJavaFuture: java.util.concurrent.Future[_ <: Nothing]

    Convert a Twitter Future to a Java native Future.

    Convert a Twitter Future to a Java native Future. This should match the semantics of a Java Future as closely as possible to avoid issues with the way another API might use them. At the same time, its semantics should be similar to those of a Twitter Future, so it propagates cancellation. See:

    https://download.oracle.com/javase/6/docs/api/java/util/concurrent/Future.html#cancel(boolean)

    Definition Classes
    Future
  54. def toOffer: Offer[Try[Nothing]]

    An Offer for this future.

    An Offer for this future.

    The offer is activated when the future is satisfied.

    Definition Classes
    Future
  55. def toString(): String
    Definition Classes
    AnyRef → Any
  56. def transform[B](f: (Try[Nothing]) => Future[B]): Future[B]

    When this future completes, run f on that completed result whether or not this computation was successful.

    When this future completes, run f on that completed result whether or not this computation was successful.

    The returned Future will be satisfied when this, the original future, and f are done.

    Definition Classes
    NoFutureFuture
    Example:
    1. import com.twitter.util.{Await, Future, Return, Throw}
      val f1: Future[Int] = Future.value(1)
      val f2: Future[Int] = Future.exception(new Exception("boom!"))
      val transforming: Future[Int] => Future[String] = x => x.transform {
      	case Return(i) => Future.value(i.toString)
      	case Throw(e) => Future.value(e.getMessage)
      }
      Await.result(transforming(f1)) // String = 1
      Await.result(transforming(f2)) // String = "boom!"
      
      // Await.result blocks the current thread,
      // don't use it except for tests.
    See also

    respond for purely side-effecting callbacks.

    map and flatMap for dealing strictly with successful computations.

    handle and rescue for dealing strictly with exceptional computations.

    transformedBy for a Java friendly API.

  57. def transformTry[B](f: (Try[Nothing]) => Try[B]): Future[B]

    When this future completes, run f on that completed result whether or not this computation was successful.

    When this future completes, run f on that completed result whether or not this computation was successful.

    Attributes
    protected
    Definition Classes
    NoFutureFuture
    Note

    This method is similar to transform, but the transformation is applied without introducing an intermediate future, which leads to fewer allocations. The promise is satisfied directly instead of wrapping a Future around a Try. The returned Future will be satisfied when this, the original future, is done.

    See also

    respond for purely side-effecting callbacks.

    map and flatMap for dealing strictly with successful computations.

    handle and rescue for dealing strictly with exceptional computations.

    transformedBy for a Java friendly API.

    transform for transformations that return Future.

  58. def transformedBy[B](transformer: FutureTransformer[Nothing, B]): Future[B]

    Transform the Future[A] into a Future[B] using the FutureTransformer.

    Transform the Future[A] into a Future[B] using the FutureTransformer. The FutureTransformer handles both success (Return) and failure (Throw) values by implementing map/flatMap and handle/rescue. This method is typically used by Java programs because it avoids the use of small Function objects.

    Definition Classes
    Future
    Note

    The FutureTransformer must implement either flatMap or map and may optionally implement handle. Failing to implement a method will result in a run-time error (AbstractMethodError).

    See also

    transform for a Scala API.

    addEventListener for a Java friendly way to perform side-effects.

  59. def unit: Future[Unit]

    Convert this Future[A] to a Future[Unit] by discarding the result.

    Convert this Future[A] to a Future[Unit] by discarding the result.

    Definition Classes
    Future
    Note

    failed futures will remain as is.

  60. def voided: Future[Void]

    Convert this Future[A] to a Future[Void] by discarding the result.

    Convert this Future[A] to a Future[Void] by discarding the result.

    Definition Classes
    Future
    Note

    failed futures will remain as is.

  61. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  62. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  63. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  64. def willEqual[B](that: Future[B]): Future[Boolean]

    Returns a Future[Boolean] indicating whether two Futures are equivalent.

    Returns a Future[Boolean] indicating whether two Futures are equivalent.

    Note that

    Future.exception(e).willEqual(Future.exception(e)) == Future.value(true)

    .

    Future.exception(e).willEqual(Future.exception(e)) == Future.value(true) }}}

    Definition Classes
    Future
  65. def withFilter(p: (Nothing) => Boolean): Future[Nothing]
    Definition Classes
    Future
  66. def within(timer: Timer, timeout: Duration, exc: => Throwable): Future[Nothing]

    Returns a new Future that fails if it is not satisfied in time.

    Returns a new Future that fails if it is not satisfied in time.

    Note: On timeout, the underlying future is not interrupted.

    timer

    to run timeout on.

    timeout

    indicates how long you are willing to wait for the result to be available.

    exc

    exception to throw.

    Definition Classes
    Future
  67. def within(timer: Timer, timeout: Duration): Future[Nothing]

    Returns a new Future that fails if it is not satisfied in time.

    Returns a new Future that fails if it is not satisfied in time.

    Note: On timeout, the underlying future is not interrupted.

    Definition Classes
    Future
  68. def within(timeout: Duration)(implicit timer: Timer): Future[Nothing]

    Returns a new Future that fails if it is not satisfied in time.

    Returns a new Future that fails if it is not satisfied in time.

    Same as the other within, but with an implicit timer. Sometimes this is more convenient.

    Note: On timeout, the underlying future is not interrupted.

    Definition Classes
    Future

Inherited from Future[Nothing]

Inherited from Awaitable[Nothing]

Inherited from AnyRef

Inherited from Any

Ungrouped