假设我写的阿卡演员作为阿卡 - 国家管理路由器
class SomeActor extends Actor {
val state = mutable.Map[String, Long]()
def receive = { // Do some processing on the state
}
override def postStop() {
println(Integer.toHexString(System.identityHashCode(state)))
}
}
现在对于负载均衡,如果我用循环的路由器
actorSystem.actorOf(Props(classOf[SomeActor]).withRouter(RoundRobinRouter(nrOfInstances=10)))
如何在这样一个不阿卡管理状态场景?阿卡在这样的情况下保证安全吗?
我喜欢这个
我看到有演员的10个实例,所以在轮转路由器,也应该没有状态保持?我在这里 – winash
@winash对不起,我不明白。有10个演员实例,每个演员都有自己的地图。 – Jatin
对不起我的错误。我现在明白了 – winash