object FutureUtil
- Since
20 Jan 2018
- Alphabetic
- By Inheritance
- FutureUtil
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
asIO[T](f: ⇒ future.Future[T])(implicit ec: future.ExecutionContext): IO[T]
Safely suspend a Future in an IO monad, making this call referrentially transparent, if the given future is yielded by a def or an uninitialized lazy val.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
asResult[T](f: future.Future[T])(implicit ec: future.ExecutionContext): future.Future[result.Result[T]]
Captures the failure of this Future in a Result.
Captures the failure of this Future in a Result. Preserves the underlying Anomaly type, if the failed Future is because of a non-Anomaly throwable, then it will be wrapped in a CatastrophicError
- def asUnitFuture[T](f: future.Future[T])(implicit ec: future.ExecutionContext): future.Future[Unit]
- def bimap[T, R](f: future.Future[T], good: (T) ⇒ R, bad: (Throwable) ⇒ Throwable)(implicit ec: future.ExecutionContext): future.Future[R]
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
- def cond[T](test: Boolean, correct: ⇒ T, anomaly: ⇒ Anomaly): future.Future[T]
- def condWith[T](test: Boolean, correct: ⇒ future.Future[T], anomaly: ⇒ Anomaly): future.Future[T]
- def effectOnFalse[T](test: Boolean, eff: ⇒ future.Future[T])(implicit ec: future.ExecutionContext): future.Future[Unit]
- def effectOnTrue[T](test: Boolean, eff: ⇒ future.Future[T])(implicit ec: future.ExecutionContext): future.Future[Unit]
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def fail[T](a: Anomaly): future.Future[T]
- def failOnFalse(test: Boolean, anomaly: ⇒ Anomaly): future.Future[Unit]
- def failOnTrue(test: Boolean, anomaly: ⇒ Anomaly): future.Future[Unit]
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
- def flatCond[T](test: future.Future[Boolean], correct: ⇒ T, anomaly: ⇒ Anomaly)(implicit ec: future.ExecutionContext): future.Future[T]
- def flatCondWith[T](test: future.Future[Boolean], correct: ⇒ future.Future[T], anomaly: ⇒ Anomaly)(implicit ec: future.ExecutionContext): future.Future[T]
- def flatEffectOnFalse[T](test: future.Future[Boolean], eff: ⇒ future.Future[T])(implicit ec: future.ExecutionContext): future.Future[Unit]
- def flatEffectOnTrue[T](test: future.Future[Boolean], eff: ⇒ future.Future[T])(implicit ec: future.ExecutionContext): future.Future[Unit]
- def flatFailOnFalse(test: future.Future[Boolean], anomaly: ⇒ Anomaly)(implicit ec: future.ExecutionContext): future.Future[Unit]
- def flatFailOnTrue(test: future.Future[Boolean], anomaly: ⇒ Anomaly)(implicit ec: future.ExecutionContext): future.Future[Unit]
- def fromEither[L, R](elr: Either[L, R], transformLeft: (L) ⇒ Anomaly): future.Future[R]
- def fromEither[L, R](elr: Either[L, R])(implicit ev: <:<[L, Throwable]): future.Future[R]
- def fromOption[T](opt: Option[T], ifNone: ⇒ Anomaly): future.Future[T]
- def fromResult[R](r: result.Result[R]): future.Future[R]
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def morph[T, R](f: future.Future[T], morphism: (result.Result[T]) ⇒ result.Result[R])(implicit ec: future.ExecutionContext): future.Future[R]
-
def
morph[T, R](f: future.Future[T], bad: (Throwable) ⇒ R, good: (T) ⇒ R)(implicit ec: future.ExecutionContext): future.Future[R]
Used to transform the underlying Future into a successful one.
Used to transform the underlying Future into a successful one. The functions should be pure, and not throw any exception.
- returns
A Future that is successfull
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def optionFlatten[T](fopt: future.Future[Option[T]], ifNone: ⇒ Anomaly)(implicit ec: future.ExecutionContext): future.Future[T]
- def pure[T](t: T): future.Future[T]
- def resultFlatten[T](fres: future.Future[result.Result[T]])(implicit ec: future.ExecutionContext): future.Future[T]
-
def
serialize[A, B, C[X] <: TraversableOnce[X]](col: C[A])(fn: (A) ⇒ future.Future[B])(implicit cbf: CanBuildFrom[C[A], B, C[B]], ec: future.ExecutionContext): future.Future[C[B]]
Syntactically inspired from Future.traverse, but it differs semantically insofar as this method does not attempt to run any futures in parallel.
Syntactically inspired from Future.traverse, but it differs semantically insofar as this method does not attempt to run any futures in parallel.
For the vast majority of cases you should prefer this method over Future.sequence and Future.traverse, since even small collections can easily wind up queuing so many Futures that you blow your execution context.
Usage:
import busymachines.future._ val patches: Seq[Patch] = //... //this ensures that no two changes will be applied in parallel. val allPatches: Future[Seq[Patch]] = Future.serialize(patches){ patch: Patch => Future { //apply patch } } //... and so on, and so on!
-
def
syncAsResult[T](f: future.Future[T], timeout: duration.FiniteDuration = duration.minutes(1)): result.Result[T]
Using this is highly discouraged
Using this is highly discouraged
This is here more as a convenience method for testing
-
def
syncAwaitReady[T](f: future.Future[T], timeout: duration.FiniteDuration = duration.minutes(1)): future.Future[T]
Using this is highly discouraged
Using this is highly discouraged
This is here more as a convenience method for testing
-
def
syncUnsafeGet[T](f: future.Future[T], timeout: duration.FiniteDuration = duration.minutes(1)): T
Using this is highly discouraged
Using this is highly discouraged
This is here more as a convenience method for testing
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )