Akka PoisonPill是否会杀死其子女的后代?

编程入门 行业动态 更新时间:2024-10-26 22:17:35
本文介绍了Akka PoisonPill是否会杀死其子女的后代?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用毒丸杀死演员(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是否会杀死其子女的后代?

本文发布于:2023-11-25 18:33:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1630871.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:是否会   后代   子女   Akka   PoisonPill

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!