简体   繁体   English

在AKKA中,在主管上调用关闭会阻止它监督的所有演员吗?

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

Let's say I have a supervisor that has linked 2 actors. 假设我有一个链接2个演员的主管。 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? 调用supervisor.shutdown()会停止所有演员还是我还需要手动停止我的演员?

gracias 格拉西亚斯

Stopping a supervisor (calling Supervisor.stop() ) stops all linked (supervised) actors: 停止主管 (调用Supervisor.stop() )会停止所有链接(受监督)的actor:

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时,还有另一种正确的方法 ,使用Actor Registry(它保存有关系统范围内所有actor的信息):

Actor.registry.shutdownAll

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM