scala future/promise usage

来源:互联网 发布:golang syscall包 编辑:程序博客网 时间:2024/05/01 01:08

scala future and promise:


we can wrap up the future in future {} and create the Future[T] as the return value.

For chain actions, we can use map, or we can use for/yield (which can be translated into map actually)

The usage of recover, recoverWith, fallbackTo, andThen.

using blocking() for any blocking code instead of using the Awaitable trait.

val f  = p.future


0 0