我想f通过查看其持有的价值来检查Future 是否现在完成.那不是
f onComplete {
}
Run Code Online (Sandbox Code Playgroud)
它是关于检查它当前没有阻塞的值.
你的意见?
f.value match {
case Some(Success(x)) => println(s"the future is completed successfully with value $x")
case Some(Failure(e)) => println(s"the future failed with an error: $e")
case None => println("the future has not yet completed")
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3204 次 |
| 最近记录: |