使用ScalaTest与Await.result的ScalaFutures的优点

栏目: Scala · 发布时间: 5年前

内容简介:ScalaFutures完成的轮询是通过调度程序完成的(afaik);因此,它不会阻止任何线程.因此,您可能会有许多并发运行的测试,这些测试远远超过了测试实际运行的ExecutionContext上可用的线程.翻译自:https://stackoverflow.com/questions/27319697/advantages-of-using-scalafutures-from-scalatest-vs-await-result
我最近与同事就ScalaTest中的 Scala

Futures与测试中的Await.result的使用或whenReady或.futureValue进行了讨论.除了可读性,使用whenReady时配置(超时)和结果范围的一致性,使用ScalaFutures方法比Await.result还有其他明显的优势吗?

我注意到ScalaFutures使用“轮询”技术而不是像Await一样阻止,但有人可以详细说明优势吗?

ScalaFutures完成的轮询是通过调度程序完成的(afaik);因此,它不会阻止任何线程.因此,您可能会有许多并发运行的测试,这些测试远远超过了测试实际运行的ExecutionContext上可用的线程.

翻译自:https://stackoverflow.com/questions/27319697/advantages-of-using-scalafutures-from-scalatest-vs-await-result


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Getting Started with C++ Audio Programming for Game Development

Getting Started with C++ Audio Programming for Game Development

David Gouveia

Written specifically to help C++ developers add audio to their games from scratch, this book gives a clear introduction to the concepts and practical application of audio programming using the FMOD li......一起来看看 《Getting Started with C++ Audio Programming for Game Development》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具