我需要启动Akka(2.0)的actor系统,发送一些消息,然后等待它完成重要工作。之后,我需要执行与这些actors无关的其他任务。
我尝试使用以下代码等待所有actor停止:
val system = new ActorSystem("parallelRunners")
val master = system.actorOf(Props[Master])
master ! Start
system.awaitTermination // <-- hangs here
所有的演员都通过self ! PoisonPill
来自我销毁。我做错了什么?
ActorSystem.terminate()
代替ActorSystem.shutdown()
。 - 203