Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用 scala 规范测试一些演员。我在 IDEA 或 Maven(作为 junit)中运行测试,它没有退出。查看代码,我的测试完成了,但是一些内部线程(调度程序)正在徘徊。我怎样才能完成测试?
目前,这只能通过强制关闭 actor 框架的调度程序来实现:
scala.actors.Scheduler.impl.shutdown
但是,调度程序的底层实现最近在补丁版本中发生了变化,因此这可能会有所不同,或者与您所在的版本不太匹配。在2.7.7中,默认调度程序似乎是scala.actors.FJTaskScheduler2这种方法应该适用的实例,但是如果你最终得到 aSingleThreadedScheduler它不会,因为该shutdown方法是无操作的
scala.actors.FJTaskScheduler2
SingleThreadedScheduler
shutdown
这仅在您的演员react当时没有等待时才有效
react