I am currently studying fault tolerance and supervisor strategies in Akka (Java version).
at ... http://doc.akka.io/docs/akka/2.3.2/java/fault-tolerance.html and http://doc.akka.io/docs/akka/2.3.2/general/ supervision.html # supervision
A few questions:
1) Should we ever use try / catch blocks in our actors when we know what exceptions to expect? Why or why not? If not, should we rely on a supervisor strategy to effectively handle the exceptions a child could throw?
2) By default, if the supervisor is not explicitly configured in the parent actor, it looks like any child actor that throws an exception will be reset by default. What if none of your actors in your entire system have a state ... Should we really do reboots?
3) What if your top-level actors created by system.actorOf (...) raise an exception? How do you provide a supervisor strategy outside the cast system?
4) Assume that the scenario in which actor A has a child actor B. Now let's say that actor A asks actor B to do some work.
Some code might look like this:
Future<Object> future = Patterns.ask(child, message, timeout); future.onComplete(new OnComplete<Object>() { @Override public void onComplete(Throwable failure, Object result) throws Throwable { ... handle here }
Now ... what if actor A somehow throws an exception. By default, it is rebooted by the supervisor. The question is, is the “close” onComplete still being executed in the future, or is it effectively “destroyed” upon reboot?
5) Suppose I have a hierarchy such as: A-> B-> C. Suppose also that I redefine preRestart so that I DO NOT actually stop my children. In A prestart, it calls getContext (). ActorOf (B), and in B preart, it calls getContext (). ActorOf (C). If A throws an exception, will there be more than one actor B and there will be more than one actor C in the system?
Thanks!
java akka akka-supervision
HiChews123
source share