diff --git a/akka-docs/rst/scala/code/docs/actor/FaultHandlingDocSpec.scala b/akka-docs/rst/scala/code/docs/actor/FaultHandlingDocSpec.scala index a85d016ba2..8c9d940ede 100644 --- a/akka-docs/rst/scala/code/docs/actor/FaultHandlingDocSpec.scala +++ b/akka-docs/rst/scala/code/docs/actor/FaultHandlingDocSpec.scala @@ -63,6 +63,24 @@ object FaultHandlingDocSpec { } //#supervisor2 + class Supervisor3 extends Actor { + //#default-strategy-fallback + import akka.actor.OneForOneStrategy + import akka.actor.SupervisorStrategy._ + import scala.concurrent.duration._ + + override val supervisorStrategy = + OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) { + case _: ArithmeticException ⇒ Resume + case t ⇒ + super.supervisorStrategy.decider.applyOrElse(t, (_: Any) ⇒ Escalate) + } + //#default-strategy-fallback + + def receive = Actor.emptyBehavior + } + //#supervisor + //#child class Child extends Actor { var state = 0 diff --git a/akka-docs/rst/scala/fault-tolerance.rst b/akka-docs/rst/scala/fault-tolerance.rst index 050edb4788..ffd0a46122 100644 --- a/akka-docs/rst/scala/fault-tolerance.rst +++ b/akka-docs/rst/scala/fault-tolerance.rst @@ -72,6 +72,11 @@ exceptions are handled by default: If the exception escalate all the way up to the root guardian it will handle it in the same way as the default strategy defined above. +You can combine your own strategy with the default strategy: + +.. includecode:: code/docs/actor/FaultHandlingDocSpec.scala + :include: default-strategy-fallback + Stopping Supervisor Strategy ^^^^^^^^^^^^^^^^^^^^^^^^^^^^