Hi Sebastian, All of our sample code snippets are compiled during build, so they cannot be (shouldn't be ;) ) out of date with the library itself. That particular code snippet comes from this file:
akka/akka-docs/rst/java/code/docs/actor/FaultHandlingTest.java which is compiled. Are you sure you have the necessary imports? These ones are relevant: import akka.actor.SupervisorStrategy; import static akka.actor.SupervisorStrategy.resume; import static akka.actor.SupervisorStrategy.restart; import static akka.actor.SupervisorStrategy.stop; import static akka.actor.SupervisorStrategy.escalate; import akka.actor.SupervisorStrategy.Directive; import akka.actor.OneForOneStrategy; Where do you get compile errors? Some kind of IDE (Eclipse, IntelliJ) gives them or from javac? -Endre On Mon, Aug 25, 2014 at 8:46 AM, Sebastian Heglmeier < [email protected]> wrote: > Hi everybody, > > I tried akka (2.3.5) for a day now. I like the concepts a lot but found it > particularly difficult to get started following official & unofficial > tutorials - maybe due to the fact that the akka API changed quite a lot and > tutorials get old quickly. > While I could find a way around most differences between docu and code, > I'm stuck with the sample code for a SupervisorStrategy ( > http://doc.akka.io/docs/akka/2.3.5/java/fault-tolerance.html). > Here I get compilation errors since Resume/Restart/Stop/Escalate are > incompatible to Directive. Unfortunately my knowledge about > traits&inheritance in Scala is at zero and I can't get myself out of this > situation easily. > > a) does someone have a solution for his particular problem? > b) is there a place where one can find an up-to-date documentation? > > Cheers, Seb > > Code Snippet from official docu: > > private static SupervisorStrategy strategy = > new OneForOneStrategy(10, Duration.create("1 minute"), > new Function<Throwable, Directive>() { > @Override > public 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(); > } > } > }); > > > -- > >>>>>>>>>> Read the docs: http://akka.io/docs/ > >>>>>>>>>> Check the FAQ: > http://doc.akka.io/docs/akka/current/additional/faq.html > >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user > --- > You received this message because you are subscribed to the Google Groups > "Akka User List" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/d/optout. > -- Akka Team Typesafe - The software stack for applications that scale Blog: letitcrash.com Twitter: @akkateam -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
