public final class BackoffSupervisor extends java.lang.Object implements Actor, HandleBackoff
akka.pattern.BackoffSupervisor.props
with Backoff.onStop
.Modifier and Type | Class and Description |
---|---|
static class |
BackoffSupervisor.CurrentChild
Send this message to the
BackoffSupervisor and it will reply with
BackoffSupervisor.CurrentChild containing the ActorRef of the current child, if any. |
static class |
BackoffSupervisor.CurrentChild$ |
static class |
BackoffSupervisor.GetCurrentChild$
Send this message to the
BackoffSupervisor and it will reply with
BackoffSupervisor.CurrentChild containing the ActorRef of the current child, if any. |
static class |
BackoffSupervisor.GetRestartCount$
Send this message to the
BackoffSupervisor and it will reply with
BackoffSupervisor.RestartCount containing the current restart count. |
static class |
BackoffSupervisor.Reset$
Send this message to the
BackoffSupervisor and it will reset the back-off. |
static class |
BackoffSupervisor.ResetRestartCount |
static class |
BackoffSupervisor.ResetRestartCount$ |
static class |
BackoffSupervisor.RestartCount |
static class |
BackoffSupervisor.RestartCount$ |
static class |
BackoffSupervisor.StartChild$ |
Actor.emptyBehavior$, Actor.ignoringBehavior$
Constructor and Description |
---|
BackoffSupervisor(Props childProps,
java.lang.String childName,
scala.concurrent.duration.FiniteDuration minBackoff,
scala.concurrent.duration.FiniteDuration maxBackoff,
BackoffReset reset,
double randomFactor,
SupervisorStrategy strategy) |
BackoffSupervisor(Props childProps,
java.lang.String childName,
scala.concurrent.duration.FiniteDuration minBackoff,
scala.concurrent.duration.FiniteDuration maxBackoff,
double randomFactor) |
BackoffSupervisor(Props childProps,
java.lang.String childName,
scala.concurrent.duration.FiniteDuration minBackoff,
scala.concurrent.duration.FiniteDuration maxBackoff,
double randomFactor,
SupervisorStrategy supervisorStrategy) |
Modifier and Type | Method and Description |
---|---|
protected abstract static void |
akka$actor$Actor$_setter_$context_$eq(ActorContext x$1) |
protected abstract static void |
akka$actor$Actor$_setter_$self_$eq(ActorRef x$1) |
protected static void |
aroundPostRestart(java.lang.Throwable reason) |
protected static void |
aroundPostStop() |
protected static void |
aroundPreRestart(java.lang.Throwable reason,
scala.Option<java.lang.Object> message) |
protected static void |
aroundPreStart() |
protected static void |
aroundReceive(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive,
java.lang.Object msg) |
static scala.concurrent.duration.FiniteDuration |
calculateDelay(int restartCount,
scala.concurrent.duration.FiniteDuration minBackoff,
scala.concurrent.duration.FiniteDuration maxBackoff,
double randomFactor)
INTERNAL API
|
static void |
child_$eq(scala.Option<ActorRef> x$1) |
scala.Option<ActorRef> |
child() |
java.lang.String |
childName() |
Props |
childProps() |
ActorContext |
context()
Stores the context for this actor, including self, and sender.
|
static BackoffSupervisor.GetCurrentChild$ |
getCurrentChild()
Java API: Send this message to the
BackoffSupervisor and it will reply with
BackoffSupervisor.CurrentChild containing the ActorRef of the current child, if any. |
static BackoffSupervisor.GetRestartCount$ |
getRestartCount()
Java API: Send this message to the
BackoffSupervisor and it will reply with
BackoffSupervisor.RestartCount containing the current restart count. |
static scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> |
handleBackoff() |
scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> |
onTerminated() |
static void |
postRestart(java.lang.Throwable reason) |
static void |
postStop() |
static void |
preRestart(java.lang.Throwable reason,
scala.Option<java.lang.Object> message) |
static void |
preStart() |
static Props |
props(BackoffOptions options)
Props for creating a
BackoffSupervisor actor from BackoffOptions . |
static Props |
props(Props childProps,
java.lang.String childName,
scala.concurrent.duration.FiniteDuration minBackoff,
scala.concurrent.duration.FiniteDuration maxBackoff,
double randomFactor)
Props for creating a
BackoffSupervisor actor. |
static Props |
propsWithSupervisorStrategy(Props childProps,
java.lang.String childName,
scala.concurrent.duration.FiniteDuration minBackoff,
scala.concurrent.duration.FiniteDuration maxBackoff,
double randomFactor,
SupervisorStrategy strategy)
Props for creating a
BackoffSupervisor actor with a custom
supervision strategy. |
scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> |
receive()
This defines the initial actor behavior, it must return a partial function
with the actor logic.
|
BackoffReset |
reset() |
static void |
restartCount_$eq(int x$1) |
int |
restartCount() |
ActorRef |
self()
The 'self' field holds the ActorRef for this actor.
|
static ActorRef |
sender() |
static void |
startChild() |
SupervisorStrategy |
supervisorStrategy()
User overridable definition the strategy to use for supervising
child actors.
|
static void |
unhandled(java.lang.Object message) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, postRestart, postStop, preRestart, preStart, sender, unhandled
handleBackoff, preStart, startChild
public BackoffSupervisor(Props childProps, java.lang.String childName, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, BackoffReset reset, double randomFactor, SupervisorStrategy strategy)
public BackoffSupervisor(Props childProps, java.lang.String childName, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, double randomFactor, SupervisorStrategy supervisorStrategy)
public BackoffSupervisor(Props childProps, java.lang.String childName, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, double randomFactor)
public static Props props(Props childProps, java.lang.String childName, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, double randomFactor)
BackoffSupervisor
actor.
Exceptions in the child are handled with the default supervision strategy, i.e.
most exceptions will immediately restart the child. You can define another
supervision strategy by using propsWithSupervisorStrategy(akka.actor.Props, java.lang.String, scala.concurrent.duration.FiniteDuration, scala.concurrent.duration.FiniteDuration, double, akka.actor.SupervisorStrategy)
.
childProps
- the Props
of the child actor that
will be started and supervisedchildName
- name of the child actorminBackoff
- minimum (initial) duration until the child actor will
started again, if it is terminatedmaxBackoff
- the exponential back-off is capped to this durationrandomFactor
- after calculation of the exponential back-off an additional
random delay based on this factor is added, e.g. 0.2
adds up to 20%
delay.
In order to skip this additional delay pass in 0
.public static Props propsWithSupervisorStrategy(Props childProps, java.lang.String childName, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, double randomFactor, SupervisorStrategy strategy)
BackoffSupervisor
actor with a custom
supervision strategy.
Exceptions in the child are handled with the given supervisionStrategy
. A
Restart
will perform a normal immediate restart of the child. A Stop
will
stop the child, but it will be started again after the back-off duration.
childProps
- the Props
of the child actor that
will be started and supervisedchildName
- name of the child actorminBackoff
- minimum (initial) duration until the child actor will
started again, if it is terminatedmaxBackoff
- the exponential back-off is capped to this durationrandomFactor
- after calculation of the exponential back-off an additional
random delay based on this factor is added, e.g. 0.2
adds up to 20%
delay.
In order to skip this additional delay pass in 0
.strategy
- the supervision strategy to use for handling exceptions
in the childpublic static Props props(BackoffOptions options)
BackoffSupervisor
actor from BackoffOptions
.
options
- the BackoffOptions
that specify how to construct a backoff-supervisor.public static BackoffSupervisor.GetCurrentChild$ getCurrentChild()
BackoffSupervisor
and it will reply with
BackoffSupervisor.CurrentChild
containing the ActorRef
of the current child, if any.public static BackoffSupervisor.GetRestartCount$ getRestartCount()
BackoffSupervisor
and it will reply with
BackoffSupervisor.RestartCount
containing the current restart count.public static scala.concurrent.duration.FiniteDuration calculateDelay(int restartCount, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, double randomFactor)
Calculates an exponential back off delay.
restartCount
- (undocumented)minBackoff
- (undocumented)maxBackoff
- (undocumented)randomFactor
- (undocumented)public static final ActorRef sender()
protected static void aroundReceive(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive, java.lang.Object msg)
protected static void aroundPreStart()
protected static void aroundPostStop()
protected static void aroundPreRestart(java.lang.Throwable reason, scala.Option<java.lang.Object> message)
protected static void aroundPostRestart(java.lang.Throwable reason)
public static void preStart() throws java.lang.Exception
java.lang.Exception
public static void postStop() throws java.lang.Exception
java.lang.Exception
public static void preRestart(java.lang.Throwable reason, scala.Option<java.lang.Object> message) throws java.lang.Exception
java.lang.Exception
public static void postRestart(java.lang.Throwable reason) throws java.lang.Exception
java.lang.Exception
public static void unhandled(java.lang.Object message)
protected abstract static void akka$actor$Actor$_setter_$context_$eq(ActorContext x$1)
protected abstract static void akka$actor$Actor$_setter_$self_$eq(ActorRef x$1)
public static void child_$eq(scala.Option<ActorRef> x$1)
public static void restartCount_$eq(int x$1)
public static void startChild()
public static scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> handleBackoff()
public scala.Option<ActorRef> child()
child
in interface HandleBackoff
public int restartCount()
restartCount
in interface HandleBackoff
public ActorContext context()
Actor
forward
.
WARNING: Only valid within the Actor itself, so do not close over it and publish it to other threads!
ActorContext
is the Scala API. getContext
returns a
UntypedActorContext
, which is the Java API of the actor
context.
public final ActorRef self()
Actor
self ! message
public Props childProps()
childProps
in interface HandleBackoff
public java.lang.String childName()
childName
in interface HandleBackoff
public BackoffReset reset()
reset
in interface HandleBackoff
public SupervisorStrategy supervisorStrategy()
Actor
supervisorStrategy
in interface Actor
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> onTerminated()