akka.actor
Class OneForOneStrategy

java.lang.Object
  extended by akka.actor.SupervisorStrategy
      extended by akka.actor.OneForOneStrategy
All Implemented Interfaces:
java.io.Serializable, scala.Equals, scala.Product

public class OneForOneStrategy
extends SupervisorStrategy
implements scala.Product, scala.Serializable

Applies the fault handling Directive (Resume, Restart, Stop) specified in the Decider to the child actor that failed, as opposed to AllForOneStrategy that applies it to all children.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class akka.actor.SupervisorStrategy
SupervisorStrategy.Directive, SupervisorStrategy.Escalate$, SupervisorStrategy.Restart$, SupervisorStrategy.Resume$, SupervisorStrategy.Stop$
 
Constructor Summary
OneForOneStrategy(int maxNrOfRetries, scala.concurrent.duration.Duration withinTimeRange, java.lang.Class<?>[] trapExit)
           
OneForOneStrategy(int maxNrOfRetries, scala.concurrent.duration.Duration withinTimeRange, Function<java.lang.Throwable,SupervisorStrategy.Directive> decider)
           
OneForOneStrategy(int maxNrOfRetries, scala.concurrent.duration.Duration withinTimeRange, java.lang.Iterable<java.lang.Class<? extends java.lang.Throwable>> trapExit)
           
OneForOneStrategy(int maxNrOfRetries, scala.concurrent.duration.Duration withinTimeRange, scala.PartialFunction<java.lang.Throwable,SupervisorStrategy.Directive> decider)
           
 
Method Summary
 scala.PartialFunction<java.lang.Throwable,SupervisorStrategy.Directive> decider()
          Returns the Decider that is associated with this SupervisorStrategy.
 void handleChildTerminated(ActorContext context, ActorRef child, scala.collection.Iterable<ActorRef> children)
          This method is called after the child has been removed from the set of children.
 int maxNrOfRetries()
           
 void processFailure(ActorContext context, boolean restart, ActorRef child, java.lang.Throwable cause, ChildRestartStats stats, scala.collection.Iterable<ChildRestartStats> children)
          This method is called to act on the failure of a child: restart if the flag is true, stop otherwise.
 scala.concurrent.duration.Duration withinTimeRange()
           
 
Methods inherited from class akka.actor.SupervisorStrategy
defaultStrategy, escalate, escalateDefault, handleFailure, makeDecider, makeDecider, makeDecider, makeDecider, makeDecider, restart, restartChild, resume, resumeChild, seqThrowable2Decider, stop, stoppingStrategy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface scala.Product
productArity, productElement, productIterator, productPrefix
 
Methods inherited from interface scala.Equals
canEqual, equals
 

Constructor Detail

OneForOneStrategy

public OneForOneStrategy(int maxNrOfRetries,
                         scala.concurrent.duration.Duration withinTimeRange,
                         scala.PartialFunction<java.lang.Throwable,SupervisorStrategy.Directive> decider)

OneForOneStrategy

public OneForOneStrategy(int maxNrOfRetries,
                         scala.concurrent.duration.Duration withinTimeRange,
                         Function<java.lang.Throwable,SupervisorStrategy.Directive> decider)

OneForOneStrategy

public OneForOneStrategy(int maxNrOfRetries,
                         scala.concurrent.duration.Duration withinTimeRange,
                         java.lang.Iterable<java.lang.Class<? extends java.lang.Throwable>> trapExit)

OneForOneStrategy

public OneForOneStrategy(int maxNrOfRetries,
                         scala.concurrent.duration.Duration withinTimeRange,
                         java.lang.Class<?>[] trapExit)
Method Detail

maxNrOfRetries

public int maxNrOfRetries()

withinTimeRange

public scala.concurrent.duration.Duration withinTimeRange()

decider

public scala.PartialFunction<java.lang.Throwable,SupervisorStrategy.Directive> decider()
Description copied from class: SupervisorStrategy
Returns the Decider that is associated with this SupervisorStrategy. The Decider is invoked by the default implementation of handleFailure to obtain the Directive to be applied.

Specified by:
decider in class SupervisorStrategy

handleChildTerminated

public void handleChildTerminated(ActorContext context,
                                  ActorRef child,
                                  scala.collection.Iterable<ActorRef> children)
Description copied from class: SupervisorStrategy
This method is called after the child has been removed from the set of children. It does not need to do anything special. Exceptions thrown from this method do NOT make the actor fail if this happens during termination.

Specified by:
handleChildTerminated in class SupervisorStrategy

processFailure

public void processFailure(ActorContext context,
                           boolean restart,
                           ActorRef child,
                           java.lang.Throwable cause,
                           ChildRestartStats stats,
                           scala.collection.Iterable<ChildRestartStats> children)
Description copied from class: SupervisorStrategy
This method is called to act on the failure of a child: restart if the flag is true, stop otherwise.

Specified by:
processFailure in class SupervisorStrategy