我正在尝试将OneForOneStrategy应用到一个简单的Hello-Akka程序中,如下所示,基于这份文档:http://doc.akka.io/docs/akka/2.3.2/java/fault-tolerance.html
private static SupervisorStrategy strategy = new OneForOneStrategy(10,
Duration.create("1 minute"),
new Function<Throwable, SupervisorStrategy.Directive>() {
@Override
public SupervisorStrategy.Directive apply(Throwable t) {
if (t instanceof ArithmeticException) {
return resume();
} else if (t instanceof NullPointerException) {
return restart();
} else if (t instanceof IllegalArgumentException) {
return stop();
} else {
return escalate();
}
}
}
);
@Override
public SupervisorStrategy supervisorStrategy() {
return strategy;
}
但是,简历/重新启动/停止/升级方法调用不能直接编译通过。为什么?