gpt4 book ai didi

java - akka actors 工具包 - context.actorOf 与 system.actorOf

转载 作者:塔克拉玛干 更新时间:2023-11-03 03:12:48 24 4
gpt4 key购买 nike

你能给我解释一下

之间的区别吗

context.actorOf

system.actorOf

?

最佳答案

这个问题的答案很容易在 Akka 文档中找到:

An actor system is typically started by creating actors beneath the guardian actor using the ActorSystem.actorOf method and then using ActorContext.actorOf from within the created actors to spawn the actor tree.

  • 使用 System.actorOf 生成的 actors 将是监护人 actor 的 child 。
  • 使用 context.actorOf 生成的 Actor 将是上下文本身的子项 - 即调用该方法的 actor。

作为一个更一般的建议,确保在搜索类似答案时彻底探索 Akka 文档。

关于java - akka actors 工具包 - context.actorOf 与 system.actorOf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41263820/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com