In AKKA does calling shutdown on a supervisor stop all the actors it's supervising?

情到浓时终转凉″ 提交于 2019-12-06 23:52:14

问题


Let's say I have a supervisor that has linked 2 actors. When my app shutsdown I want to shutdown those actors gracefully. Does calling supervisor.shutdown() stop all the actors or do I still need to stop my actors manually?

gracias


回答1:


Stopping a supervisor (calling Supervisor.stop()) stops all linked (supervised) actors:

final class SupervisorActor{
...
   override def postStop(): Unit = shutdownLinkedActors

However, when you want to shutdown all actors in the system gracefully, there's another proper way to do that, using Actor Registry (that holds information about all the actors systemwide):

Actor.registry.shutdownAll


来源:https://stackoverflow.com/questions/5046079/in-akka-does-calling-shutdown-on-a-supervisor-stop-all-the-actors-its-supervisi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!