假设我有一位主管已经联系了两位演员。当我的应用程序关闭时,我想优雅地关闭这些演员。调用supervisor.shutdown()会停止所有演员还是我还需要手动停止我的演员?
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
推荐答案停止主管(调用 Supervisor.stop())停止所有链接(受监督)演员:
Stopping a supervisor (calling Supervisor.stop()) stops all linked (supervised) actors:
final class SupervisorActor{ ... override def postStop(): Unit = shutdownLinkedActors但是,如果要优雅地关闭系统中的所有actor,还有另一个正确的方法,使用Actor Registry(包含系统范围内所有演员的信息):
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更多推荐
在AKKA中,在主管上调用关闭会阻止它监督的所有演员吗?
发布评论