【问题标题】:What is the difference between complete and completeWith in Promise of Scala?Scala的Promise中的complete和completeWith有什么区别?
【发布时间】:2013-12-17 00:48:27
【问题描述】:

我知道它们有不同的界面,但我想知道它们在本质上有何不同。如果我将 Future 而不是 Try 传递给 Promise 的完整函数会有什么不同?

【问题讨论】:

    标签: scala promise future


    【解决方案1】:

    您不能将Future 传递给complete。它不会输入检查。

    completeWith 的目的是用给定未来的结果来完成承诺。 这意味着它必须等待未来完成。

    【讨论】:

      猜你喜欢
      • 2011-12-06
      • 2017-02-06
      • 2011-11-30
      • 2016-09-18
      • 1970-01-01
      • 2020-03-14
      • 2016-07-04
      • 2019-01-20
      • 2011-12-02
      相关资源
      最近更新 更多