public class OneForOneStrategy extends SupervisorStrategy implements scala.Product, scala.Serializable
Directive
(Resume, Restart, Stop) specified in the Decider
to the child actor that failed, as opposed to AllForOneStrategy
that applies
it to all children.
param: maxNrOfRetries the number of times a child actor is allowed to be restarted, negative value means no limit,
if the limit is exceeded the child actor is stopped
param: withinTimeRange duration of the time window for maxNrOfRetries, Duration.Inf means no window
param: decider mapping from Throwable to SupervisorStrategy.Directive
, you can also use a
Seq
of Throwables which maps the given Throwables to restarts, otherwise escalates.
param: loggingEnabled the strategy logs the failure if this is enabled (true), by default it is enabled
SupervisorStrategy.Directive, SupervisorStrategy.Escalate$, SupervisorStrategy.Restart$, SupervisorStrategy.Resume$, SupervisorStrategy.Stop$
Constructor and Description |
---|
OneForOneStrategy(boolean loggingEnabled,
scala.PartialFunction<java.lang.Throwable,SupervisorStrategy.Directive> decider)
Java API: compatible with lambda expressions
This is an EXPERIMENTAL feature and is subject to change until it has received more real world testing.
|
OneForOneStrategy(int maxNrOfRetries,
scala.concurrent.duration.Duration withinTimeRange,
boolean loggingEnabled,
scala.PartialFunction<java.lang.Throwable,SupervisorStrategy.Directive> decider) |
OneForOneStrategy(int maxNrOfRetries,
scala.concurrent.duration.Duration withinTimeRange,
Function<java.lang.Throwable,SupervisorStrategy.Directive> decider)
Java API
|
OneForOneStrategy(int maxNrOfRetries,
scala.concurrent.duration.Duration withinTimeRange,
Function<java.lang.Throwable,SupervisorStrategy.Directive> decider,
boolean loggingEnabled)
Java API
|
OneForOneStrategy(int maxNrOfRetries,
scala.concurrent.duration.Duration withinTimeRange,
java.lang.Iterable<java.lang.Class<? extends java.lang.Throwable>> trapExit)
Java API
|
OneForOneStrategy(int maxNrOfRetries,
scala.concurrent.duration.Duration withinTimeRange,
scala.PartialFunction<java.lang.Throwable,SupervisorStrategy.Directive> decider)
Java API: compatible with lambda expressions
This is an EXPERIMENTAL feature and is subject to change until it has received more real world testing.
|
OneForOneStrategy(scala.PartialFunction<java.lang.Throwable,SupervisorStrategy.Directive> decider)
Java API: compatible with lambda expressions
This is an EXPERIMENTAL feature and is subject to change until it has received more real world testing.
|
Modifier and Type | Method and Description |
---|---|
abstract static boolean |
canEqual(java.lang.Object that) |
scala.PartialFunction<java.lang.Throwable,SupervisorStrategy.Directive> |
decider()
Returns the Decider that is associated with this SupervisorStrategy.
|
abstract static boolean |
equals(java.lang.Object that) |
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.
|
static boolean |
handleFailure(ActorContext context,
ActorRef child,
java.lang.Throwable cause,
ChildRestartStats stats,
scala.collection.Iterable<ChildRestartStats> children) |
static void |
logFailure(ActorContext context,
ActorRef child,
java.lang.Throwable cause,
SupervisorStrategy.Directive decision) |
boolean |
loggingEnabled()
Logging of actor failures is done when this is
true . |
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.
|
abstract static int |
productArity() |
abstract static java.lang.Object |
productElement(int n) |
static scala.collection.Iterator<java.lang.Object> |
productIterator() |
static java.lang.String |
productPrefix() |
static void |
restartChild(ActorRef child,
java.lang.Throwable cause,
boolean suspendFirst) |
static void |
resumeChild(ActorRef child,
java.lang.Throwable cause) |
scala.concurrent.duration.Duration |
withinTimeRange() |
defaultDecider, defaultStrategy, escalate, escalateDefault, handleFailure, logFailure, makeDecider, makeDecider, makeDecider, makeDecider, maxNrOfRetriesOption, restart, restartChild, resume, resumeChild, seqThrowable2Decider, sort, stop, stoppingStrategy, withinTimeRangeOption
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public OneForOneStrategy(int maxNrOfRetries, scala.concurrent.duration.Duration withinTimeRange, boolean loggingEnabled, scala.PartialFunction<java.lang.Throwable,SupervisorStrategy.Directive> decider)
public OneForOneStrategy(int maxNrOfRetries, scala.concurrent.duration.Duration withinTimeRange, Function<java.lang.Throwable,SupervisorStrategy.Directive> decider, boolean loggingEnabled)
maxNrOfRetries
- (undocumented)withinTimeRange
- (undocumented)decider
- (undocumented)loggingEnabled
- (undocumented)public OneForOneStrategy(int maxNrOfRetries, scala.concurrent.duration.Duration withinTimeRange, Function<java.lang.Throwable,SupervisorStrategy.Directive> decider)
maxNrOfRetries
- (undocumented)withinTimeRange
- (undocumented)decider
- (undocumented)public OneForOneStrategy(int maxNrOfRetries, scala.concurrent.duration.Duration withinTimeRange, java.lang.Iterable<java.lang.Class<? extends java.lang.Throwable>> trapExit)
maxNrOfRetries
- (undocumented)withinTimeRange
- (undocumented)trapExit
- (undocumented)public OneForOneStrategy(int maxNrOfRetries, scala.concurrent.duration.Duration withinTimeRange, scala.PartialFunction<java.lang.Throwable,SupervisorStrategy.Directive> decider)
maxNrOfRetries
- (undocumented)withinTimeRange
- (undocumented)decider
- (undocumented)public OneForOneStrategy(boolean loggingEnabled, scala.PartialFunction<java.lang.Throwable,SupervisorStrategy.Directive> decider)
loggingEnabled
- (undocumented)decider
- (undocumented)public OneForOneStrategy(scala.PartialFunction<java.lang.Throwable,SupervisorStrategy.Directive> decider)
decider
- (undocumented)public static boolean handleFailure(ActorContext context, ActorRef child, java.lang.Throwable cause, ChildRestartStats stats, scala.collection.Iterable<ChildRestartStats> children)
public static void logFailure(ActorContext context, ActorRef child, java.lang.Throwable cause, SupervisorStrategy.Directive decision)
public static final void resumeChild(ActorRef child, java.lang.Throwable cause)
public static final void restartChild(ActorRef child, java.lang.Throwable cause, boolean suspendFirst)
public abstract static boolean canEqual(java.lang.Object that)
public abstract static boolean equals(java.lang.Object that)
public abstract static java.lang.Object productElement(int n)
public abstract static int productArity()
public static scala.collection.Iterator<java.lang.Object> productIterator()
public static java.lang.String productPrefix()
public int maxNrOfRetries()
public scala.concurrent.duration.Duration withinTimeRange()
public boolean loggingEnabled()
SupervisorStrategy
true
.loggingEnabled
in class SupervisorStrategy
public scala.PartialFunction<java.lang.Throwable,SupervisorStrategy.Directive> decider()
SupervisorStrategy
handleFailure
to obtain the Directive to be applied.decider
in class SupervisorStrategy
public void handleChildTerminated(ActorContext context, ActorRef child, scala.collection.Iterable<ActorRef> children)
SupervisorStrategy
handleChildTerminated
in class SupervisorStrategy
context
- (undocumented)child
- (undocumented)children
- (undocumented)public void processFailure(ActorContext context, boolean restart, ActorRef child, java.lang.Throwable cause, ChildRestartStats stats, scala.collection.Iterable<ChildRestartStats> children)
SupervisorStrategy
processFailure
in class SupervisorStrategy
context
- (undocumented)restart
- (undocumented)child
- (undocumented)cause
- (undocumented)stats
- (undocumented)children
- (undocumented)