title: Akka Java fault tolerance and actor restarting
body: <p>I'm currently looking into Fault Tolerance and Supervisor strategies in Akka (Java version). </p>
  
  <p>at ... <a href="http://doc.akka.io/docs/akka/2.3.2/java/fault-tolerance.html" rel="noreferrer">http://doc.akka.io/docs/akka/2.3.2/java/fault-tolerance.html</a> and <a href="http://doc.akka.io/docs/akka/2.3.2/general/supervision.html#supervision" rel="noreferrer">http://doc.akka.io/docs/akka/2.3.2/general/supervision.html#supervision</a></p>
  
  <p>A few questions:</p>
  
  <p>1) Should we ever use try/catch blocks in our actors when we know what kind of exceptions to expect? Why or why not? If not, should we depend on a supervisor strategy to effectively handle exceptions that a child might throw?</p>
  
  <p>2) By default, if no supervisor is configured explicitly in a parent actor, it looks like any child actor who throws an exception will be restarted by default. What if none of your actors in your entire system carry state...Should we really be doing restarts?</p>
  
  <p>3) What if your top-level actors created by system.actorOf( ... ) throws an exception? How do you provide a supervisor strategy outside of the actor system?</p>
  
  <p>4) Let's assume a scenario in which actor A has a child actor B. Now let's say Actor A asks Actor B to do some work.</p>
  
  <p>Some code might look like this:</p>
  
  <pre><code>Future&lt;Object&gt; future = Patterns.ask(child, message, timeout);
  future.onComplete(new OnComplete&lt;Object&gt;() {
  
      @Override
      public void onComplete(Throwable failure, Object result) throws Throwable {
               ... handle here    
      }
  </code></pre>
  
  <p>Now... what if actor A somehow throws an exception. By default it is restarted by its supervisor. The question is, does the onComplete "closure" still get executed sometime in the future, or is it effectively "wiped out" on the restart?</p>
  
  <p>5) Let's assume I have a hierarchy as such as: A->B->C. Let's also assume that I override preRestart so that I effectively do NOT stop my children. On A's prestart he calls getContext().actorOf(B), and in B's prestart he calls getContext().actorOf(C). If A throws an exception, will more than one actor B and more than one actor C now exist in the system?</p>
  
  <p>Thanks!</p>