Packages

o

akka.pattern

Backoff

object Backoff

Annotations
@Deprecated @deprecated
Deprecated

(Since version 2.5.22) Use new API from BackoffOpts object instead

Source
Backoff.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Backoff
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate() @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  13. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  15. def toString(): String
    Definition Classes
    AnyRef → Any
  16. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  17. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  18. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

  2. def onFailure(childProps: Props, childName: String, minBackoff: Duration, maxBackoff: Duration, randomFactor: Double): BackoffOptions

    Java API: Back-off options for creating a back-off supervisor actor that expects a child actor to restart on failure.

    Java API: Back-off options for creating a back-off supervisor actor that expects a child actor to restart on failure.

    This explicit supervisor behaves similarly to the normal implicit supervision where if an actor throws an exception, the decider on the supervisor will decide when to Stop, Restart, Escalate, Resume the child actor.

    When the Restart directive is specified, the supervisor will delay the restart using an exponential back off strategy (bounded by minBackoff and maxBackoff).

    This supervisor is intended to be transparent to both the child actor and external actors. Where external actors can send messages to the supervisor as if it was the child and the messages will be forwarded. And when the child is Terminated, the supervisor is also Terminated. Transparent to the child means that the child does not have to be aware that it is being supervised specifically by this actor. Just like it does not need to know when it is being supervised by the usual implicit supervisors. The only caveat is that the ActorRef of the child is not stable, so any user storing the sender() ActorRef from the child response may eventually not be able to communicate with the stored ActorRef. In general all messages to the child should be directed through this actor.

    An example of where this supervisor might be used is when you may have an actor that is responsible for continuously polling on a server for some resource that sometimes may be down. Instead of hammering the server continuously when the resource is unavailable, the actor will be restarted with an exponentially increasing back off until the resource is available again.

    *** This supervisor should not be used with Akka Persistence child actors. Akka Persistence actors shutdown unconditionally on persistFailure()s rather than throw an exception on a failure like normal actors. #onStop should be used instead for cases where the child actor terminates itself as a failure signal instead of the normal behavior of throwing an exception. *** You can define another supervision strategy by using akka.pattern.BackoffOptions.withSupervisorStrategy on akka.pattern.BackoffOptions.

    childProps

    the akka.actor.Props of the child actor that will be started and supervised

    childName

    name of the child actor

    minBackoff

    minimum (initial) duration until the child actor will started again, if it is terminated

    maxBackoff

    the exponential back-off is capped to this duration

    randomFactor

    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.

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.17) Use the overloaded one which accepts maxNrOfRetries instead.

  3. def onFailure(childProps: Props, childName: String, minBackoff: Duration, maxBackoff: Duration, randomFactor: Double, maxNrOfRetries: Int): BackoffOptions

    Java API: Back-off options for creating a back-off supervisor actor that expects a child actor to restart on failure.

    Java API: Back-off options for creating a back-off supervisor actor that expects a child actor to restart on failure.

    This explicit supervisor behaves similarly to the normal implicit supervision where if an actor throws an exception, the decider on the supervisor will decide when to Stop, Restart, Escalate, Resume the child actor.

    When the Restart directive is specified, the supervisor will delay the restart using an exponential back off strategy (bounded by minBackoff and maxBackoff).

    This supervisor is intended to be transparent to both the child actor and external actors. Where external actors can send messages to the supervisor as if it was the child and the messages will be forwarded. And when the child is Terminated, the supervisor is also Terminated. Transparent to the child means that the child does not have to be aware that it is being supervised specifically by this actor. Just like it does not need to know when it is being supervised by the usual implicit supervisors. The only caveat is that the ActorRef of the child is not stable, so any user storing the sender() ActorRef from the child response may eventually not be able to communicate with the stored ActorRef. In general all messages to the child should be directed through this actor.

    An example of where this supervisor might be used is when you may have an actor that is responsible for continuously polling on a server for some resource that sometimes may be down. Instead of hammering the server continuously when the resource is unavailable, the actor will be restarted with an exponentially increasing back off until the resource is available again.

    *** This supervisor should not be used with Akka Persistence child actors. Akka Persistence actors shutdown unconditionally on persistFailure()s rather than throw an exception on a failure like normal actors. #onStop should be used instead for cases where the child actor terminates itself as a failure signal instead of the normal behavior of throwing an exception. *** You can define another supervision strategy by using akka.pattern.BackoffOptions.withSupervisorStrategy on akka.pattern.BackoffOptions.

    childProps

    the akka.actor.Props of the child actor that will be started and supervised

    childName

    name of the child actor

    minBackoff

    minimum (initial) duration until the child actor will started again, if it is terminated

    maxBackoff

    the exponential back-off is capped to this duration

    randomFactor

    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.

    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.

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.22) Use BackoffOpts.onFailure instead

  4. def onFailure(childProps: Props, childName: String, minBackoff: FiniteDuration, maxBackoff: FiniteDuration, randomFactor: Double): BackoffOptions

    Back-off options for creating a back-off supervisor actor that expects a child actor to restart on failure.

    Back-off options for creating a back-off supervisor actor that expects a child actor to restart on failure.

    This explicit supervisor behaves similarly to the normal implicit supervision where if an actor throws an exception, the decider on the supervisor will decide when to Stop, Restart, Escalate, Resume the child actor.

    When the Restart directive is specified, the supervisor will delay the restart using an exponential back off strategy (bounded by minBackoff and maxBackoff).

    This supervisor is intended to be transparent to both the child actor and external actors. Where external actors can send messages to the supervisor as if it was the child and the messages will be forwarded. And when the child is Terminated, the supervisor is also Terminated. Transparent to the child means that the child does not have to be aware that it is being supervised specifically by this actor. Just like it does not need to know when it is being supervised by the usual implicit supervisors. The only caveat is that the ActorRef of the child is not stable, so any user storing the sender() ActorRef from the child response may eventually not be able to communicate with the stored ActorRef. In general all messages to the child should be directed through this actor.

    An example of where this supervisor might be used is when you may have an actor that is responsible for continuously polling on a server for some resource that sometimes may be down. Instead of hammering the server continuously when the resource is unavailable, the actor will be restarted with an exponentially increasing back off until the resource is available again.

    *** This supervisor should not be used with Akka Persistence child actors. Akka Persistence actors shutdown unconditionally on persistFailure()s rather than throw an exception on a failure like normal actors. #onStop should be used instead for cases where the child actor terminates itself as a failure signal instead of the normal behavior of throwing an exception. *** You can define another supervision strategy by using akka.pattern.BackoffOptions.withSupervisorStrategy on akka.pattern.BackoffOptions.

    childProps

    the akka.actor.Props of the child actor that will be started and supervised

    childName

    name of the child actor

    minBackoff

    minimum (initial) duration until the child actor will started again, if it is terminated

    maxBackoff

    the exponential back-off is capped to this duration

    randomFactor

    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.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.5.22) Use BackoffOpts.onFailure instead

  5. def onFailure(childProps: Props, childName: String, minBackoff: FiniteDuration, maxBackoff: FiniteDuration, randomFactor: Double, maxNrOfRetries: Int): BackoffOptions

    Back-off options for creating a back-off supervisor actor that expects a child actor to restart on failure.

    Back-off options for creating a back-off supervisor actor that expects a child actor to restart on failure.

    This explicit supervisor behaves similarly to the normal implicit supervision where if an actor throws an exception, the decider on the supervisor will decide when to Stop, Restart, Escalate, Resume the child actor.

    When the Restart directive is specified, the supervisor will delay the restart using an exponential back off strategy (bounded by minBackoff and maxBackoff).

    This supervisor is intended to be transparent to both the child actor and external actors. Where external actors can send messages to the supervisor as if it was the child and the messages will be forwarded. And when the child is Terminated, the supervisor is also Terminated. Transparent to the child means that the child does not have to be aware that it is being supervised specifically by this actor. Just like it does not need to know when it is being supervised by the usual implicit supervisors. The only caveat is that the ActorRef of the child is not stable, so any user storing the sender() ActorRef from the child response may eventually not be able to communicate with the stored ActorRef. In general all messages to the child should be directed through this actor.

    An example of where this supervisor might be used is when you may have an actor that is responsible for continuously polling on a server for some resource that sometimes may be down. Instead of hammering the server continuously when the resource is unavailable, the actor will be restarted with an exponentially increasing back off until the resource is available again.

    *** This supervisor should not be used with Akka Persistence child actors. Akka Persistence actors shutdown unconditionally on persistFailure()s rather than throw an exception on a failure like normal actors. #onStop should be used instead for cases where the child actor terminates itself as a failure signal instead of the normal behavior of throwing an exception. *** You can define another supervision strategy by using akka.pattern.BackoffOptions.withSupervisorStrategy on akka.pattern.BackoffOptions.

    childProps

    the akka.actor.Props of the child actor that will be started and supervised

    childName

    name of the child actor

    minBackoff

    minimum (initial) duration until the child actor will started again, if it is terminated

    maxBackoff

    the exponential back-off is capped to this duration

    randomFactor

    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.

    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.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.5.22) Use BackoffOpts.onFailure instead

  6. def onStop(childProps: Props, childName: String, minBackoff: Duration, maxBackoff: Duration, randomFactor: Double): BackoffOptions

    Java API: Back-off options for creating a back-off supervisor actor that expects a child actor to stop on failure.

    Java API: Back-off options for creating a back-off supervisor actor that expects a child actor to stop on failure.

    This actor can be used to supervise a child actor and start it again after a back-off duration if the child actor is stopped.

    This is useful in situations where the re-start of the child actor should be delayed e.g. in order to give an external resource time to recover before the child actor tries contacting it again (after being restarted).

    Specifically this pattern is useful for persistent actors, which are stopped in case of persistence failures. Just restarting them immediately would probably fail again (since the data store is probably unavailable). It is better to try again after a delay.

    It supports exponential back-off between the given minBackoff and maxBackoff durations. For example, if minBackoff is 3 seconds and maxBackoff 30 seconds the start attempts will be delayed with 3, 6, 12, 24, 30, 30 seconds. The exponential back-off counter is reset if the actor is not terminated within the minBackoff duration.

    In addition to the calculated exponential back-off an additional random delay based the given randomFactor is added, e.g. 0.2 adds up to 20% delay. The reason for adding a random delay is to avoid that all failing actors hit the backend resource at the same time.

    You can retrieve the current child ActorRef by sending BackoffSupervisor.GetCurrentChild message to this actor and it will reply with akka.pattern.BackoffSupervisor.CurrentChild containing the ActorRef of the current child, if any.

    The BackoffSupervisordelegates all messages from the child to the parent of the BackoffSupervisor, with the supervisor as sender.

    The BackoffSupervisor forwards all other messages to the child, if it is currently running.

    The child can stop itself and send a akka.actor.PoisonPill to the parent supervisor if it wants to do an intentional stop.

    Exceptions in the child are handled with the default supervisionStrategy, which can be changed by using BackoffOptions#withSupervisorStrategy or BackoffOptions#withDefaultStoppingStrategy. 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 akka.actor.Props of the child actor that will be started and supervised

    childName

    name of the child actor

    minBackoff

    minimum (initial) duration until the child actor will started again, if it is terminated

    maxBackoff

    the exponential back-off is capped to this duration

    randomFactor

    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.

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.17) Use the overloaded one which accepts maxNrOfRetries instead.

  7. def onStop(childProps: Props, childName: String, minBackoff: Duration, maxBackoff: Duration, randomFactor: Double, maxNrOfRetries: Int): BackoffOptions

    Java API: Back-off options for creating a back-off supervisor actor that expects a child actor to stop on failure.

    Java API: Back-off options for creating a back-off supervisor actor that expects a child actor to stop on failure.

    This actor can be used to supervise a child actor and start it again after a back-off duration if the child actor is stopped.

    This is useful in situations where the re-start of the child actor should be delayed e.g. in order to give an external resource time to recover before the child actor tries contacting it again (after being restarted).

    Specifically this pattern is useful for persistent actors, which are stopped in case of persistence failures. Just restarting them immediately would probably fail again (since the data store is probably unavailable). It is better to try again after a delay.

    It supports exponential back-off between the given minBackoff and maxBackoff durations. For example, if minBackoff is 3 seconds and maxBackoff 30 seconds the start attempts will be delayed with 3, 6, 12, 24, 30, 30 seconds. The exponential back-off counter is reset if the actor is not terminated within the minBackoff duration.

    In addition to the calculated exponential back-off an additional random delay based the given randomFactor is added, e.g. 0.2 adds up to 20% delay. The reason for adding a random delay is to avoid that all failing actors hit the backend resource at the same time.

    You can retrieve the current child ActorRef by sending BackoffSupervisor.GetCurrentChild message to this actor and it will reply with akka.pattern.BackoffSupervisor.CurrentChild containing the ActorRef of the current child, if any.

    The BackoffSupervisordelegates all messages from the child to the parent of the BackoffSupervisor, with the supervisor as sender.

    The BackoffSupervisor forwards all other messages to the child, if it is currently running.

    The child can stop itself and send a akka.actor.PoisonPill to the parent supervisor if it wants to do an intentional stop.

    Exceptions in the child are handled with the default supervisionStrategy, which can be changed by using BackoffOptions#withSupervisorStrategy or BackoffOptions#withDefaultStoppingStrategy. 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 akka.actor.Props of the child actor that will be started and supervised

    childName

    name of the child actor

    minBackoff

    minimum (initial) duration until the child actor will started again, if it is terminated

    maxBackoff

    the exponential back-off is capped to this duration

    randomFactor

    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.

    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.

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.22) Use BackoffOpts.onStop instead

  8. def onStop(childProps: Props, childName: String, minBackoff: FiniteDuration, maxBackoff: FiniteDuration, randomFactor: Double): BackoffOptions

    Back-off options for creating a back-off supervisor actor that expects a child actor to stop on failure.

    Back-off options for creating a back-off supervisor actor that expects a child actor to stop on failure.

    This actor can be used to supervise a child actor and start it again after a back-off duration if the child actor is stopped.

    This is useful in situations where the re-start of the child actor should be delayed e.g. in order to give an external resource time to recover before the child actor tries contacting it again (after being restarted).

    Specifically this pattern is useful for persistent actors, which are stopped in case of persistence failures. Just restarting them immediately would probably fail again (since the data store is probably unavailable). It is better to try again after a delay.

    It supports exponential back-off between the given minBackoff and maxBackoff durations. For example, if minBackoff is 3 seconds and maxBackoff 30 seconds the start attempts will be delayed with 3, 6, 12, 24, 30, 30 seconds. The exponential back-off counter is reset if the actor is not terminated within the minBackoff duration.

    In addition to the calculated exponential back-off an additional random delay based the given randomFactor is added, e.g. 0.2 adds up to 20% delay. The reason for adding a random delay is to avoid that all failing actors hit the backend resource at the same time.

    You can retrieve the current child ActorRef by sending BackoffSupervisor.GetCurrentChild message to this actor and it will reply with akka.pattern.BackoffSupervisor.CurrentChild containing the ActorRef of the current child, if any.

    The BackoffSupervisordelegates all messages from the child to the parent of the BackoffSupervisor, with the supervisor as sender.

    The BackoffSupervisor forwards all other messages to the child, if it is currently running.

    The child can stop itself and send a akka.actor.PoisonPill to the parent supervisor if it wants to do an intentional stop.

    Exceptions in the child are handled with the default supervisionStrategy, which can be changed by using BackoffOptions#withSupervisorStrategy or BackoffOptions#withDefaultStoppingStrategy. 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 akka.actor.Props of the child actor that will be started and supervised

    childName

    name of the child actor

    minBackoff

    minimum (initial) duration until the child actor will started again, if it is terminated

    maxBackoff

    the exponential back-off is capped to this duration

    randomFactor

    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.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.5.22) Use BackoffOpts.onStop instead

  9. def onStop(childProps: Props, childName: String, minBackoff: FiniteDuration, maxBackoff: FiniteDuration, randomFactor: Double, maxNrOfRetries: Int): BackoffOptions

    Back-off options for creating a back-off supervisor actor that expects a child actor to stop on failure.

    Back-off options for creating a back-off supervisor actor that expects a child actor to stop on failure.

    This actor can be used to supervise a child actor and start it again after a back-off duration if the child actor is stopped.

    This is useful in situations where the re-start of the child actor should be delayed e.g. in order to give an external resource time to recover before the child actor tries contacting it again (after being restarted).

    Specifically this pattern is useful for persistent actors, which are stopped in case of persistence failures. Just restarting them immediately would probably fail again (since the data store is probably unavailable). It is better to try again after a delay.

    It supports exponential back-off between the given minBackoff and maxBackoff durations. For example, if minBackoff is 3 seconds and maxBackoff 30 seconds the start attempts will be delayed with 3, 6, 12, 24, 30, 30 seconds. The exponential back-off counter is reset if the actor is not terminated within the minBackoff duration.

    In addition to the calculated exponential back-off an additional random delay based the given randomFactor is added, e.g. 0.2 adds up to 20% delay. The reason for adding a random delay is to avoid that all failing actors hit the backend resource at the same time.

    You can retrieve the current child ActorRef by sending BackoffSupervisor.GetCurrentChild message to this actor and it will reply with akka.pattern.BackoffSupervisor.CurrentChild containing the ActorRef of the current child, if any.

    The BackoffSupervisordelegates all messages from the child to the parent of the BackoffSupervisor, with the supervisor as sender.

    The BackoffSupervisor forwards all other messages to the child, if it is currently running.

    The child can stop itself and send a akka.actor.PoisonPill to the parent supervisor if it wants to do an intentional stop.

    Exceptions in the child are handled with the default supervisionStrategy, which can be changed by using BackoffOptions#withSupervisorStrategy or BackoffOptions#withDefaultStoppingStrategy. 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 akka.actor.Props of the child actor that will be started and supervised

    childName

    name of the child actor

    minBackoff

    minimum (initial) duration until the child actor will started again, if it is terminated

    maxBackoff

    the exponential back-off is capped to this duration

    randomFactor

    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.

    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.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.5.22) Use BackoffOpts.onStop instead

Inherited from AnyRef

Inherited from Any

Ungrouped