我正在使用毒丸杀死演员(A)的儿童演员(Bx)。每个孩子都有另一个孩子(Cx)及以后。因此,它希望 A-> B1→ C1,C2,C3→ Dx 。如果我仅将PoisonPill发送给演员B就足够了,那么它将杀死下面的后代演员?
I am using poison pill to kill children (Bx) actor of an actor (A). Each children have another children (Cx) and beyond. So it would like A -> B1 -> C1,C2,C3 -> Dx. Is it enough if I just send PoisonPill to actor B, then it will kill descendent actors below?
Thanksa
推荐答案是的,一旦演员收到 PoisonPill 消息,它将不再接收消息并将停止发送给子演员。
Yes, once the actor receives PoisonPill message, it stop taking anymore messages and send stop to child actors.
从演员生命周期中可以明显看出,父演员会在 preRestart 期间杀死所有子演员,并等待其终止,在父演员停止之前。如果您不想让孩子停下来,请覆盖preRestart 直接调用 postStop 。
Its clear from actor lifecycle that the parent actor will kill any child actors during preRestart and wait for its termination, before the parent actor is stopped. In you case dont want children to stop, then override preRestart to directly call postStop.
更多推荐
Akka PoisonPill是否会杀死其子女的后代?
发布评论