org.megam.util

Future

object Future

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Future
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
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. val DEFAULT_TIMEOUT: Duration

  7. val Done: Future[Unit]

  8. val False: Future[Boolean]

  9. val Nil: Future[Seq[Nothing]]

  10. val None: Future[Option[Nothing]]

  11. val True: Future[Boolean]

  12. val Unit: Future[Unit]

  13. val Void: Future[Void]

  14. def apply[A](a: ⇒ A): Future[A]

    A factory function to "lift" computations into the Future monad.

    A factory function to "lift" computations into the Future monad. It will catch nonfatal (see: org.megam.util.NonFatal) exceptions and wrap them in the Throw[_] type. Non-exceptional values are wrapped in the Return[_] type.

  15. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  16. def batched[In, Out](sizeThreshold: Int, timeThreshold: Duration = Duration.Top, sizePercentile: ⇒ Float = 1.0f)(f: (Seq[In]) ⇒ Future[Seq[Out]])(implicit timer: Timer): (In) ⇒ Future[Out]

    Creates a "batched" Future that, given a function Seq[In] => Future[Seq[Out]], returns a In => Future[Out] interface that batches the underlying asynchronous operations.

    Creates a "batched" Future that, given a function Seq[In] => Future[Seq[Out]], returns a In => Future[Out] interface that batches the underlying asynchronous operations. Thus, one can incrementally submit tasks to be performed when the criteria for batch flushing is met.

    Example:

    val timer = new JavaTimer(true) def processBatch(reqs: Seq[Request]): Future[Seq[Response]] val batcher = Future.batched(sizeThreshold = 10) { processBatch } val response: Future[Response] = batcher(new Request)

    batcher will wait until 10 requests have been submitted, then delegate to the processBatch method to compute the responses.

    Batchers can be constructed with both size- or time-based thresholds:

    val batcher = Future.batched(sizeThreshold = 10, timeThreshold = 10.milliseconds) { ... }

    A batcher's size can be controlled at runtime with the sizePercentile function argument. This function returns a float between 0.0 and 1.0, representing the fractional size of the sizeThreshold that should be used for the next batch to be collected.

  17. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. def collect[A](fs: List[Future[A]]): Future[List[A]]

    Collect the results from the given futures into a new future of Seq[A].

    Collect the results from the given futures into a new future of Seq[A]. If one or of the given futures is exceptional, the resulting future result will be the first exception encountered.

    fs

    a java.util.List of Futures

    returns

    a Future[java.util.List[A]] containing the collected values from fs.

  19. def collect[A](fs: Seq[Future[A]]): Future[Seq[A]]

    Collect the results from the given futures into a new future of Seq[A].

    Collect the results from the given futures into a new future of Seq[A]. If one or of the given Futures is exceptional, the resulting Future result will be the first exception encountered.

    fs

    a sequence of Futures

    returns

    a Future[Seq[A]] containing the collected values from fs.

  20. def collectToTry[A](fs: List[Future[A]]): Future[List[Try[A]]]

    Collect the results from the given futures into a new future of Seq[Try[A]]

    Collect the results from the given futures into a new future of Seq[Try[A]]

    fs

    a java.util.List of Futures

    returns

    a Future[java.util.List[Try[A]]] containing the collected values from fs.

  21. def collectToTry[A](fs: Seq[Future[A]]): Future[Seq[Try[A]]]

    Collect the results from the given futures into a new future of Seq[Try[A]]

    Collect the results from the given futures into a new future of Seq[Try[A]]

    fs

    a sequence of Futures

    returns

    a Future[Seq[Try[A]]] containing the collected values from fs.

  22. def const[A](result: Try[A]): Future[A]

    Makes a Future with a constant result.

  23. final def eq(arg0: AnyRef): Boolean

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

    Definition Classes
    AnyRef → Any
  25. def exception[A](e: Throwable): Future[A]

    Make a Future with an error.

    Make a Future with an error. E.g., Future.exception(new Exception("boo")).

  26. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  27. def flatten[A](ffa: Future[Future[A]]): Future[A]

    Flattens a nested future.

    Flattens a nested future. Same as ffa.flatten, but easier to call from Java.

  28. final def getClass(): Class[_]

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

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

    Definition Classes
    Any
  31. def join[A](fs: List[Future[A]]): Future[Unit]

    Take a sequence of Futures, wait till they all complete successfully.

    Take a sequence of Futures, wait till they all complete successfully. The future fails immediately if any of the joined Futures do, mimicking the semantics of exceptions.

    fs

    a java.util.List of Futures

    returns

    a Future[Unit] whose value is populated when all of the fs return.

  32. def join[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V](a: Future[A], b: Future[B], c: Future[C], d: Future[D], e: Future[E], f: Future[F], g: Future[G], h: Future[H], i: Future[I], j: Future[J], k: Future[K], l: Future[L], m: Future[M], n: Future[N], o: Future[O], p: Future[P], q: Future[Q], r: Future[R], s: Future[S], t: Future[T], u: Future[U], v: Future[V]): Future[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)]

    Join 22 futures.

    Join 22 futures. The returned future is complete when all underlying futures complete. It fails immediately if any of them do.

  33. def join[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U](a: Future[A], b: Future[B], c: Future[C], d: Future[D], e: Future[E], f: Future[F], g: Future[G], h: Future[H], i: Future[I], j: Future[J], k: Future[K], l: Future[L], m: Future[M], n: Future[N], o: Future[O], p: Future[P], q: Future[Q], r: Future[R], s: Future[S], t: Future[T], u: Future[U]): Future[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)]

    Join 21 futures.

    Join 21 futures. The returned future is complete when all underlying futures complete. It fails immediately if any of them do.

  34. def join[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T](a: Future[A], b: Future[B], c: Future[C], d: Future[D], e: Future[E], f: Future[F], g: Future[G], h: Future[H], i: Future[I], j: Future[J], k: Future[K], l: Future[L], m: Future[M], n: Future[N], o: Future[O], p: Future[P], q: Future[Q], r: Future[R], s: Future[S], t: Future[T]): Future[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)]

    Join 20 futures.

    Join 20 futures. The returned future is complete when all underlying futures complete. It fails immediately if any of them do.

  35. def join[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S](a: Future[A], b: Future[B], c: Future[C], d: Future[D], e: Future[E], f: Future[F], g: Future[G], h: Future[H], i: Future[I], j: Future[J], k: Future[K], l: Future[L], m: Future[M], n: Future[N], o: Future[O], p: Future[P], q: Future[Q], r: Future[R], s: Future[S]): Future[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)]

    Join 19 futures.

    Join 19 futures. The returned future is complete when all underlying futures complete. It fails immediately if any of them do.

  36. def join[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R](a: Future[A], b: Future[B], c: Future[C], d: Future[D], e: Future[E], f: Future[F], g: Future[G], h: Future[H], i: Future[I], j: Future[J], k: Future[K], l: Future[L], m: Future[M], n: Future[N], o: Future[O], p: Future[P], q: Future[Q], r: Future[R]): Future[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)]

    Join 18 futures.

    Join 18 futures. The returned future is complete when all underlying futures complete. It fails immediately if any of them do.

  37. def join[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q](a: Future[A], b: Future[B], c: Future[C], d: Future[D], e: Future[E], f: Future[F], g: Future[G], h: Future[H], i: Future[I], j: Future[J], k: Future[K], l: Future[L], m: Future[M], n: Future[N], o: Future[O], p: Future[P], q: Future[Q]): Future[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)]

    Join 17 futures.

    Join 17 futures. The returned future is complete when all underlying futures complete. It fails immediately if any of them do.

  38. def join[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P](a: Future[A], b: Future[B], c: Future[C], d: Future[D], e: Future[E], f: Future[F], g: Future[G], h: Future[H], i: Future[I], j: Future[J], k: Future[K], l: Future[L], m: Future[M], n: Future[N], o: Future[O], p: Future[P]): Future[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)]

    Join 16 futures.

    Join 16 futures. The returned future is complete when all underlying futures complete. It fails immediately if any of them do.

  39. def join[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O](a: Future[A], b: Future[B], c: Future[C], d: Future[D], e: Future[E], f: Future[F], g: Future[G], h: Future[H], i: Future[I], j: Future[J], k: Future[K], l: Future[L], m: Future[M], n: Future[N], o: Future[O]): Future[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)]

    Join 15 futures.

    Join 15 futures. The returned future is complete when all underlying futures complete. It fails immediately if any of them do.

  40. def join[A, B, C, D, E, F, G, H, I, J, K, L, M, N](a: Future[A], b: Future[B], c: Future[C], d: Future[D], e: Future[E], f: Future[F], g: Future[G], h: Future[H], i: Future[I], j: Future[J], k: Future[K], l: Future[L], m: Future[M], n: Future[N]): Future[(A, B, C, D, E, F, G, H, I, J, K, L, M, N)]

    Join 14 futures.

    Join 14 futures. The returned future is complete when all underlying futures complete. It fails immediately if any of them do.

  41. def join[A, B, C, D, E, F, G, H, I, J, K, L, M](a: Future[A], b: Future[B], c: Future[C], d: Future[D], e: Future[E], f: Future[F], g: Future[G], h: Future[H], i: Future[I], j: Future[J], k: Future[K], l: Future[L], m: Future[M]): Future[(A, B, C, D, E, F, G, H, I, J, K, L, M)]

    Join 13 futures.

    Join 13 futures. The returned future is complete when all underlying futures complete. It fails immediately if any of them do.

  42. def join[A, B, C, D, E, F, G, H, I, J, K, L](a: Future[A], b: Future[B], c: Future[C], d: Future[D], e: Future[E], f: Future[F], g: Future[G], h: Future[H], i: Future[I], j: Future[J], k: Future[K], l: Future[L]): Future[(A, B, C, D, E, F, G, H, I, J, K, L)]

    Join 12 futures.

    Join 12 futures. The returned future is complete when all underlying futures complete. It fails immediately if any of them do.

  43. def join[A, B, C, D, E, F, G, H, I, J, K](a: Future[A], b: Future[B], c: Future[C], d: Future[D], e: Future[E], f: Future[F], g: Future[G], h: Future[H], i: Future[I], j: Future[J], k: Future[K]): Future[(A, B, C, D, E, F, G, H, I, J, K)]

    Join 11 futures.

    Join 11 futures. The returned future is complete when all underlying futures complete. It fails immediately if any of them do.

  44. def join[A, B, C, D, E, F, G, H, I, J](a: Future[A], b: Future[B], c: Future[C], d: Future[D], e: Future[E], f: Future[F], g: Future[G], h: Future[H], i: Future[I], j: Future[J]): Future[(A, B, C, D, E, F, G, H, I, J)]

    Join 10 futures.

    Join 10 futures. The returned future is complete when all underlying futures complete. It fails immediately if any of them do.

  45. def join[A, B, C, D, E, F, G, H, I](a: Future[A], b: Future[B], c: Future[C], d: Future[D], e: Future[E], f: Future[F], g: Future[G], h: Future[H], i: Future[I]): Future[(A, B, C, D, E, F, G, H, I)]

    Join 9 futures.

    Join 9 futures. The returned future is complete when all underlying futures complete. It fails immediately if any of them do.

  46. def join[A, B, C, D, E, F, G, H](a: Future[A], b: Future[B], c: Future[C], d: Future[D], e: Future[E], f: Future[F], g: Future[G], h: Future[H]): Future[(A, B, C, D, E, F, G, H)]

    Join 8 futures.

    Join 8 futures. The returned future is complete when all underlying futures complete. It fails immediately if any of them do.

  47. def join[A, B, C, D, E, F, G](a: Future[A], b: Future[B], c: Future[C], d: Future[D], e: Future[E], f: Future[F], g: Future[G]): Future[(A, B, C, D, E, F, G)]

    Join 7 futures.

    Join 7 futures. The returned future is complete when all underlying futures complete. It fails immediately if any of them do.

  48. def join[A, B, C, D, E, F](a: Future[A], b: Future[B], c: Future[C], d: Future[D], e: Future[E], f: Future[F]): Future[(A, B, C, D, E, F)]

    Join 6 futures.

    Join 6 futures. The returned future is complete when all underlying futures complete. It fails immediately if any of them do.

  49. def join[A, B, C, D, E](a: Future[A], b: Future[B], c: Future[C], d: Future[D], e: Future[E]): Future[(A, B, C, D, E)]

    Join 5 futures.

    Join 5 futures. The returned future is complete when all underlying futures complete. It fails immediately if any of them do.

  50. def join[A, B, C, D](a: Future[A], b: Future[B], c: Future[C], d: Future[D]): Future[(A, B, C, D)]

    Join 4 futures.

    Join 4 futures. The returned future is complete when all underlying futures complete. It fails immediately if any of them do.

  51. def join[A, B, C](a: Future[A], b: Future[B], c: Future[C]): Future[(A, B, C)]

    Join 3 futures.

    Join 3 futures. The returned future is complete when all underlying futures complete. It fails immediately if any of them do.

  52. def join[A, B](a: Future[A], b: Future[B]): Future[(A, B)]

    Join 2 futures.

    Join 2 futures. The returned future is complete when all underlying futures complete. It fails immediately if any of them do.

  53. def join[A](fs: Seq[Future[A]]): Future[Unit]

    Take a sequence of Futures, wait till they all complete successfully.

    Take a sequence of Futures, wait till they all complete successfully. The future fails immediately if any of the joined Futures do, mimicking the semantics of exceptions.

    fs

    a sequence of Futures

    returns

    a Future[Unit] whose value is populated when all of the fs return.

  54. def monitored[A](mkFuture: ⇒ Future[A]): Future[A]

    Run the computation {{mkFuture}} while installing a monitor that translates any exception thrown into an encoded one.

    Run the computation {{mkFuture}} while installing a monitor that translates any exception thrown into an encoded one. If an exception is thrown anywhere, the underlying computation is interrupted with that exception.

    This function is usually called to wrap a computation that returns a Future (f0) whose value is satisfied by the invocation of an onSuccess/onFailure/ensure callbacks of another future (f1). If an exception happens in the callbacks on f1, f0 is never satisfied. In this example, Future.monitored { f1 onSuccess g; f0 } will cancel f0 so that f0 never hangs.

  55. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  56. val never: Future[Nothing]

    A new future that can never complete.

  57. final def notify(): Unit

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

    Definition Classes
    AnyRef
  59. def parallel[A](n: Int)(f: ⇒ Future[A]): Seq[Future[A]]

  60. def rawException[A](e: Throwable): Future[A]

    Make a Future with an error.

    Make a Future with an error. E.g., Future.exception(new Exception("boo")). The exception is not wrapped in any way.

  61. def select[A](fs: List[Future[A]]): Future[(Try[A], List[Future[A]])]

    "Select" off the first future to be satisfied.

    "Select" off the first future to be satisfied. Return this as a result, with the remainder of the Futures as a sequence.

    fs

    a java.util.List

    returns

    a Future[Tuple2[Try[A], java.util.List[Future[A]]]] representing the first future to be satisfied and the rest of the futures.

  62. def select[A](fs: Seq[Future[A]]): Future[(Try[A], Seq[Future[A]])]

    "Select" off the first future to be satisfied.

    "Select" off the first future to be satisfied. Return this as a result, with the remainder of the Futures as a sequence.

    fs

    a scala.collection.Seq

  63. def selectIndex[A](fs: IndexedSeq[Future[A]]): Future[Int]

    Select the index into fs of the first future to be satisfied.

    Select the index into fs of the first future to be satisfied.

    fs

    cannot be empty

  64. def sleep(howlong: Duration)(implicit timer: Timer): Future[Unit]

    A unit future that completes after howlong.

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

    Definition Classes
    AnyRef
  66. def times[A](n: Int)(f: ⇒ Future[A]): Future[Unit]

    Repeat a computation that returns a Future some number of times, after each computation completes.

  67. def toString(): String

    Definition Classes
    AnyRef → Any
  68. def unapply[A](f: Future[A]): Option[Try[A]]

  69. def value[A](a: A): Future[A]

    Make a Future with a constant value.

    Make a Future with a constant value. E.g., Future.value(1) is a Future[Int].

  70. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  73. def when[A](p: Boolean)(f: ⇒ Future[A]): Future[Unit]

    Perform the effects of the supplied Future only when the provided flag is true.

  74. def whileDo[A](p: ⇒ Boolean)(f: ⇒ Future[A]): Future[Unit]

    Repeat a computation that returns a Future while some predicate obtains, after each computation completes.

Deprecated Value Members

  1. def void(): Future[Void]

    Annotations
    @deprecated
    Deprecated

    (Since version 5.x) Prefer static Future.Void.

Inherited from AnyRef

Inherited from Any

Ungrouped