假設我寫的阿卡演員作爲阿卡 - 國家管理路由器
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