Class BackoffSupervisor
- java.lang.Object
-
- akka.pattern.internal.BackoffOnStopSupervisor
-
- akka.pattern.BackoffSupervisor
-
- All Implemented Interfaces:
Actor
,ActorLogging
,HandleBackoff
public final class BackoffSupervisor extends BackoffOnStopSupervisor
INTERNAL APICalculates an exponential back off delay.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BackoffSupervisor.CurrentChild
Java API: TheActorRef
of the current child, if anystatic class
BackoffSupervisor.CurrentChild$
static class
BackoffSupervisor.GetCurrentChild$
Send this message to theBackoffSupervisor
and it will reply withBackoffSupervisor.CurrentChild
containing theActorRef
of the current child, if any.static class
BackoffSupervisor.GetRestartCount$
Send this message to theBackoffSupervisor
and it will reply withBackoffSupervisor.RestartCount
containing the current restart count.static class
BackoffSupervisor.Reset$
static class
BackoffSupervisor.ResetRestartCount
static class
BackoffSupervisor.ResetRestartCount$
static class
BackoffSupervisor.RestartCount
static class
BackoffSupervisor.RestartCount$
static class
BackoffSupervisor.StartChild$
-
Nested classes/interfaces inherited from interface akka.actor.Actor
Actor.emptyBehavior$, Actor.ignoringBehavior$
-
-
Constructor Summary
Constructors Constructor Description BackoffSupervisor(Props childProps, java.lang.String childName, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, double randomFactor)
Deprecated.Use `BackoffSupervisor.props` method instead.BackoffSupervisor(Props childProps, java.lang.String childName, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, double randomFactor, SupervisorStrategy supervisorStrategy)
Deprecated.Use `BackoffSupervisor.props` method instead.BackoffSupervisor(Props childProps, java.lang.String childName, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, BackoffReset reset, double randomFactor, SupervisorStrategy strategy, scala.Option<java.lang.Object> replyWhileStopped)
Deprecated.Use `BackoffSupervisor.props` method instead.BackoffSupervisor(Props childProps, java.lang.String childName, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, BackoffReset reset, double randomFactor, SupervisorStrategy strategy, scala.Option<java.lang.Object> replyWhileStopped, scala.Option<scala.Function1<java.lang.Object,java.lang.Object>> finalStopMessage)
Deprecated.Use `BackoffSupervisor.props` method instead.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static scala.concurrent.duration.FiniteDuration
calculateDelay(int restartCount, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, double randomFactor)
java.lang.String
childName()
Props
childProps()
scala.Option<scala.Function1<java.lang.Object,java.lang.Object>>
finalStopMessage()
static BackoffSupervisor.GetCurrentChild$
getCurrentChild()
static BackoffSupervisor.GetRestartCount$
getRestartCount()
static Props
props(Props childProps, java.lang.String childName, java.time.Duration minBackoff, java.time.Duration maxBackoff, double randomFactor)
Deprecated.Use props with BackoffOpts instead.static Props
props(Props childProps, java.lang.String childName, java.time.Duration minBackoff, java.time.Duration maxBackoff, double randomFactor, int maxNrOfRetries)
Deprecated.Use props with BackoffOpts instead.static Props
props(Props childProps, java.lang.String childName, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, double randomFactor)
Deprecated.Use props with BackoffOpts instead.static Props
props(Props childProps, java.lang.String childName, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, double randomFactor, int maxNrOfRetries)
Deprecated.Use props with BackoffOpts instead.static Props
props(BackoffOnFailureOptions options)
Props for creating aBackoffSupervisor
actor fromBackoffOnFailureOptions
.static Props
props(BackoffOnStopOptions options)
Props for creating aBackoffSupervisor
actor fromBackoffOnStopOptions
.static Props
props(BackoffOptions options)
Deprecated.Use new API from BackoffOpts object instead.static Props
propsWithSupervisorStrategy(Props childProps, java.lang.String childName, java.time.Duration minBackoff, java.time.Duration maxBackoff, double randomFactor, SupervisorStrategy strategy)
Deprecated.Use props with BackoffOpts instead.static Props
propsWithSupervisorStrategy(Props childProps, java.lang.String childName, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, double randomFactor, SupervisorStrategy strategy)
Deprecated.Use props with BackoffOpts instead.scala.Option<java.lang.Object>
replyWhileStopped()
BackoffReset
reset()
-
Methods inherited from class akka.pattern.internal.BackoffOnStopSupervisor
akka$actor$Actor$_setter_$context_$eq, akka$actor$Actor$_setter_$self_$eq, child, child_$eq, context, finalStopMessageReceived, finalStopMessageReceived_$eq, handleMessageToChild, onTerminated, receive, restartCount, restartCount_$eq, self, supervisorStrategy
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface akka.actor.Actor
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, postRestart, postStop, preRestart, preStart, sender, unhandled
-
Methods inherited from interface akka.actor.ActorLogging
_log_$eq, log
-
Methods inherited from interface akka.pattern.HandleBackoff
handleBackoff, preStart, startChild
-
-
-
-
Constructor Detail
-
BackoffSupervisor
public BackoffSupervisor(Props childProps, java.lang.String childName, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, BackoffReset reset, double randomFactor, SupervisorStrategy strategy, scala.Option<java.lang.Object> replyWhileStopped, scala.Option<scala.Function1<java.lang.Object,java.lang.Object>> finalStopMessage)
Deprecated.Use `BackoffSupervisor.props` method instead. Since 2.5.22.
-
BackoffSupervisor
public BackoffSupervisor(Props childProps, java.lang.String childName, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, BackoffReset reset, double randomFactor, SupervisorStrategy strategy, scala.Option<java.lang.Object> replyWhileStopped)
Deprecated.Use `BackoffSupervisor.props` method instead. Since 2.5.22.
-
BackoffSupervisor
public BackoffSupervisor(Props childProps, java.lang.String childName, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, double randomFactor, SupervisorStrategy supervisorStrategy)
Deprecated.Use `BackoffSupervisor.props` method instead. Since 2.5.22.
-
BackoffSupervisor
public BackoffSupervisor(Props childProps, java.lang.String childName, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, double randomFactor)
Deprecated.Use `BackoffSupervisor.props` method instead. Since 2.5.22.
-
-
Method Detail
-
props
public static Props props(Props childProps, java.lang.String childName, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, double randomFactor)
Deprecated.Use props with BackoffOpts instead. Since 2.5.22.
-
props
public static Props props(Props childProps, java.lang.String childName, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, double randomFactor, int maxNrOfRetries)
Deprecated.Use props with BackoffOpts instead. Since 2.5.22.Props for creating aBackoffSupervisor
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)
.- Parameters:
childProps
- theProps
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 to20%
delay. In order to skip this additional delay pass in0
.maxNrOfRetries
- maximum number of attempts to restart the child actor. The supervisor will terminate itself after the maxNoOfRetries is reached. In order to restart infinitely pass in-1
.- Returns:
- (undocumented)
-
props
public static Props props(Props childProps, java.lang.String childName, java.time.Duration minBackoff, java.time.Duration maxBackoff, double randomFactor)
Deprecated.Use props with BackoffOpts instead. Since 2.5.22.Props for creating aBackoffSupervisor
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)
.- Parameters:
childProps
- theProps
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 to20%
delay. In order to skip this additional delay pass in0
.- Returns:
- (undocumented)
-
props
public static Props props(Props childProps, java.lang.String childName, java.time.Duration minBackoff, java.time.Duration maxBackoff, double randomFactor, int maxNrOfRetries)
Deprecated.Use props with BackoffOpts instead. Since 2.5.22.Props for creating aBackoffSupervisor
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)
.- Parameters:
childProps
- theProps
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 to20%
delay. In order to skip this additional delay pass in0
.maxNrOfRetries
- maximum number of attempts to restart the child actor. The supervisor will terminate itself after the maxNoOfRetries is reached. In order to restart infinitely pass in-1
.- Returns:
- (undocumented)
-
propsWithSupervisorStrategy
public static Props propsWithSupervisorStrategy(Props childProps, java.lang.String childName, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, double randomFactor, SupervisorStrategy strategy)
Deprecated.Use props with BackoffOpts instead. Since 2.5.22.Props for creating aBackoffSupervisor
actor with a custom supervision strategy.Exceptions in the child are handled with the given
supervisionStrategy
. ARestart
will perform a normal immediate restart of the child. AStop
will stop the child, but it will be started again after the back-off duration.- Parameters:
childProps
- theProps
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 to20%
delay. In order to skip this additional delay pass in0
.strategy
- the supervision strategy to use for handling exceptions in the child. As the BackoffSupervisor creates a separate actor to handle the backoff process, only aOneForOneStrategy
makes sense here.- Returns:
- (undocumented)
-
propsWithSupervisorStrategy
public static Props propsWithSupervisorStrategy(Props childProps, java.lang.String childName, java.time.Duration minBackoff, java.time.Duration maxBackoff, double randomFactor, SupervisorStrategy strategy)
Deprecated.Use props with BackoffOpts instead. Since 2.5.22.Props for creating aBackoffSupervisor
actor with a custom supervision strategy.Exceptions in the child are handled with the given
supervisionStrategy
. ARestart
will perform a normal immediate restart of the child. AStop
will stop the child, but it will be started again after the back-off duration.- Parameters:
childProps
- theProps
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 to20%
delay. In order to skip this additional delay pass in0
.strategy
- the supervision strategy to use for handling exceptions in the child. As the BackoffSupervisor creates a separate actor to handle the backoff process, only aOneForOneStrategy
makes sense here.- Returns:
- (undocumented)
-
props
public static Props props(BackoffOptions options)
Deprecated.Use new API from BackoffOpts object instead. Since 2.5.22.Props for creating aBackoffSupervisor
actor fromBackoffOptions
.- Parameters:
options
- theBackoffOptions
that specify how to construct a backoff-supervisor.- Returns:
- (undocumented)
-
props
public static Props props(BackoffOnStopOptions options)
Props for creating aBackoffSupervisor
actor fromBackoffOnStopOptions
.- Parameters:
options
- theBackoffOnStopOptions
that specify how to construct a backoff-supervisor.- Returns:
- (undocumented)
-
props
public static Props props(BackoffOnFailureOptions options)
Props for creating aBackoffSupervisor
actor fromBackoffOnFailureOptions
.- Parameters:
options
- theBackoffOnFailureOptions
that specify how to construct a backoff-supervisor.- Returns:
- (undocumented)
-
getCurrentChild
public static BackoffSupervisor.GetCurrentChild$ getCurrentChild()
-
getRestartCount
public static BackoffSupervisor.GetRestartCount$ getRestartCount()
-
calculateDelay
public static scala.concurrent.duration.FiniteDuration calculateDelay(int restartCount, scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, double randomFactor)
-
childProps
public Props childProps()
- Specified by:
childProps
in interfaceHandleBackoff
- Overrides:
childProps
in classBackoffOnStopSupervisor
-
childName
public java.lang.String childName()
- Specified by:
childName
in interfaceHandleBackoff
- Overrides:
childName
in classBackoffOnStopSupervisor
-
reset
public BackoffReset reset()
- Specified by:
reset
in interfaceHandleBackoff
- Overrides:
reset
in classBackoffOnStopSupervisor
-
replyWhileStopped
public scala.Option<java.lang.Object> replyWhileStopped()
-
finalStopMessage
public scala.Option<scala.Function1<java.lang.Object,java.lang.Object>> finalStopMessage()
-
-