akka.actor

OneForOneStrategy

case class OneForOneStrategy(maxNrOfRetries: Int = -1, withinTimeRange: Duration = ...)(decider: Decider) extends SupervisorStrategy with Product with Serializable

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

maxNrOfRetries

the number of times an actor is allowed to be restarted, negative value means no limit

withinTimeRange

duration of the time window for maxNrOfRetries, Duration.Inf means no window

decider

mapping from Throwable to akka.actor.SupervisorStrategy.Directive, you can also use a Seq of Throwables which maps the given Throwables to restarts, otherwise escalates.

Linear Supertypes
Serializable, Serializable, Product, Equals, SupervisorStrategy, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. OneForOneStrategy
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. SupervisorStrategy
  7. AnyRef
  8. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new OneForOneStrategy(maxNrOfRetries: Int, withinTimeRange: Duration, trapExit: Array[Class[_]])

  2. new OneForOneStrategy(maxNrOfRetries: Int, withinTimeRange: Duration, trapExit: Iterable[Class[_ <: Throwable]])

  3. new OneForOneStrategy(maxNrOfRetries: Int, withinTimeRange: Duration, decider: JDecider)

  4. new OneForOneStrategy(maxNrOfRetries: Int = -1, withinTimeRange: Duration = ...)(decider: Decider)

    maxNrOfRetries

    the number of times an actor is allowed to be restarted, negative value means no limit

    withinTimeRange

    duration of the time window for maxNrOfRetries, Duration.Inf means no window

    decider

    mapping from Throwable to akka.actor.SupervisorStrategy.Directive, you can also use a Seq of Throwables which maps the given Throwables to restarts, otherwise escalates.

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  8. val decider: Decider

    mapping from Throwable to akka.actor.SupervisorStrategy.Directive, you can also use a Seq of Throwables which maps the given Throwables to restarts, otherwise escalates.

    mapping from Throwable to akka.actor.SupervisorStrategy.Directive, you can also use a Seq of Throwables which maps the given Throwables to restarts, otherwise escalates.

    Definition Classes
    OneForOneStrategySupervisorStrategy
  9. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  10. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  11. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  12. def handleChildTerminated(context: ActorContext, child: ActorRef, children: Iterable[ActorRef]): Unit

    This method is called after the child has been removed from the set of children.

    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.

    Definition Classes
    OneForOneStrategySupervisorStrategy
  13. def handleFailure(context: ActorContext, child: ActorRef, cause: Throwable, stats: ChildRestartStats, children: Iterable[ChildRestartStats]): Boolean

    This is the main entry point: in case of a child’s failure, this method must try to handle the failure by resuming, restarting or stopping the child (and returning true), or it returns false to escalate the failure, which will lead to this actor re-throwing the exception which caused the failure.

    This is the main entry point: in case of a child’s failure, this method must try to handle the failure by resuming, restarting or stopping the child (and returning true), or it returns false to escalate the failure, which will lead to this actor re-throwing the exception which caused the failure. The exception will not be wrapped.

    children

    is a lazy collection (a view)

    Definition Classes
    SupervisorStrategy
  14. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  15. val maxNrOfRetries: Int

    the number of times an actor is allowed to be restarted, negative value means no limit

  16. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  19. def processFailure(context: ActorContext, restart: Boolean, child: ActorRef, cause: Throwable, stats: ChildRestartStats, children: Iterable[ChildRestartStats]): Unit

    This method is called to act on the failure of a child: restart if the flag is true, stop otherwise.

    This method is called to act on the failure of a child: restart if the flag is true, stop otherwise.

    Definition Classes
    OneForOneStrategySupervisorStrategy
  20. final def restartChild(child: ActorRef, cause: Throwable, suspendFirst: Boolean): Unit

    Restart the given child, possibly suspending it first.

    Restart the given child, possibly suspending it first.

    IMPORTANT:

    If the child is the currently failing one, it will already have been suspended, hence suspendFirst must be false. If the child is not the currently failing one, then it did not request this treatment and is therefore not prepared to be resumed without prior suspend.

    Definition Classes
    SupervisorStrategy
  21. final def resumeChild(child: ActorRef, cause: Throwable): Unit

    Resume the previously failed child: do never apply this to a child which is not the currently failing child.

    Resume the previously failed child: do never apply this to a child which is not the currently failing child. Suspend/resume needs to be done in matching pairs, otherwise actors will wake up too soon or never at all.

    Definition Classes
    SupervisorStrategy
  22. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  23. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  24. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  25. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  26. val withinTimeRange: Duration

    duration of the time window for maxNrOfRetries, Duration.

    duration of the time window for maxNrOfRetries, Duration.Inf means no window

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from SupervisorStrategy

Inherited from AnyRef

Inherited from Any

Ungrouped