【发布时间】:2016-05-28 05:06:43
【问题描述】:
我有一个主管 Actor,它可以像这样创建子 Actor:
class SupervisorActor extends Actor {
val child = context.actorOf(MyConnectorActor.props(config),"MyConnector")
def receive = {
case Message => child ! "throw"
}
}
class MyConnectorActor extends Actor {
def receive = {
case "throw" => throw new Exception()
}
}
现在在我的 MyConnectorActor 孩子中,我自愿抛出异常。 SupervisorActor 应该如何处理这个问题?是否需要添加主管策略?
override val supervisorStrategy =
OneForOneStrategy(maxNrOfRetries = 30, withinTimeRange = 1.minute) {
case _ =>
println("RESTARTING CHILD FROM SUPERVISOR")
Restart
}
即使添加了这个,我也看不到我的子演员重新启动?关于还需要做什么的任何想法?
【问题讨论】:
标签: akka