Class AllForOneStrategy
This class represents a fault handling strategy that applies a Directive to all child actors when one child fails.
Inherited Members
Namespace: Akka.Actor
Assembly: Akka.dll
Syntax
public class AllForOneStrategy : SupervisorStrategy, ISurrogated, IEquatable<AllForOneStrategy>
Constructors
| Edit this page View SourceAllForOneStrategy()
Initializes a new instance of the AllForOneStrategy class.
Declaration
protected AllForOneStrategy()
AllForOneStrategy(IDecider)
Initializes a new instance of the AllForOneStrategy class.
Declaration
public AllForOneStrategy(IDecider decider)
Parameters
Type | Name | Description |
---|---|---|
IDecider | decider |
AllForOneStrategy(Func<Exception, Directive>)
Initializes a new instance of the AllForOneStrategy class.
Declaration
public AllForOneStrategy(Func<Exception, Directive> localOnlyDecider)
Parameters
Type | Name | Description |
---|---|---|
Func<Exception, Directive> | localOnlyDecider |
AllForOneStrategy(int, int, IDecider, bool)
Initializes a new instance of the AllForOneStrategy class.
Declaration
public AllForOneStrategy(int maxNrOfRetries, int withinTimeMilliseconds, IDecider decider, bool loggingEnabled = true)
Parameters
Type | Name | Description |
---|---|---|
int | 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. |
int | withinTimeMilliseconds | duration in milliseconds of the time window for |
IDecider | decider | |
bool | loggingEnabled | If |
AllForOneStrategy(int, int, Func<Exception, Directive>, bool)
Initializes a new instance of the AllForOneStrategy class.
Declaration
public AllForOneStrategy(int maxNrOfRetries, int withinTimeMilliseconds, Func<Exception, Directive> localOnlyDecider, bool loggingEnabled = true)
Parameters
Type | Name | Description |
---|---|---|
int | 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. |
int | withinTimeMilliseconds | duration in milliseconds of the time window for |
Func<Exception, Directive> | localOnlyDecider | |
bool | loggingEnabled | If |
AllForOneStrategy(int?, TimeSpan?, IDecider)
Initializes a new instance of the AllForOneStrategy class.
Declaration
public AllForOneStrategy(int? maxNrOfRetries, TimeSpan? withinTimeRange, IDecider decider)
Parameters
Type | Name | Description |
---|---|---|
int? | maxNrOfRetries | The number of times a child actor is allowed to be restarted, negative value and null means no limit, if the limit is exceeded the child actor is stopped. |
TimeSpan? | withinTimeRange | duration of the time window for maxNrOfRetries, InfiniteTimeSpan means no window. |
IDecider | decider |
AllForOneStrategy(int?, TimeSpan?, Func<Exception, Directive>)
Initializes a new instance of the AllForOneStrategy class.
Declaration
public AllForOneStrategy(int? maxNrOfRetries, TimeSpan? withinTimeRange, Func<Exception, Directive> localOnlyDecider)
Parameters
Type | Name | Description |
---|---|---|
int? | maxNrOfRetries | The number of times a child actor is allowed to be restarted, negative value and null means no limit, if the limit is exceeded the child actor is stopped. |
TimeSpan? | withinTimeRange | duration of the time window for maxNrOfRetries, InfiniteTimeSpan means no window. |
Func<Exception, Directive> | localOnlyDecider |
Properties
| Edit this page View SourceDecider
Declaration
public override IDecider Decider { get; }
Property Value
Type | Description |
---|---|
IDecider |
Overrides
| Edit this page View SourceMaxNumberOfRetries
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.
Declaration
public int MaxNumberOfRetries { get; }
Property Value
Type | Description |
---|---|
int |
WithinTimeRangeMilliseconds
The duration in milliseconds of the time window for MaxNumberOfRetries, negative values means no window.
Declaration
public int WithinTimeRangeMilliseconds { get; }
Property Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceEquals(AllForOneStrategy)
Declaration
public bool Equals(AllForOneStrategy other)
Parameters
Type | Name | Description |
---|---|---|
AllForOneStrategy | other |
Returns
Type | Description |
---|---|
bool |
Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj |
Returns
Type | Description |
---|---|
bool |
Overrides
| Edit this page View SourceGetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int |
Overrides
| Edit this page View SourceHandle(IActorRef, Exception)
Determines which Directive this strategy uses to handle exception
that occur in the child
actor.
Declaration
protected override Directive Handle(IActorRef child, Exception exception)
Parameters
Type | Name | Description |
---|---|---|
IActorRef | child | The child actor where the exception occurred. |
Exception | exception | The exception that was thrown. |
Returns
Type | Description |
---|---|
Directive | The directive used to handle the exception. |
Overrides
| Edit this page View SourceHandleChildTerminated(IActorContext, IActorRef, IEnumerable<IInternalActorRef>)
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.
Declaration
public override void HandleChildTerminated(IActorContext actorContext, IActorRef child, IEnumerable<IInternalActorRef> children)
Parameters
Type | Name | Description |
---|---|---|
IActorContext | actorContext | TBD |
IActorRef | child | TBD |
IEnumerable<IInternalActorRef> | children | TBD |
Overrides
| Edit this page View SourceProcessFailure(IActorContext, bool, IActorRef, Exception, ChildRestartStats, IReadOnlyCollection<ChildRestartStats>)
This method is called to act on the failure of a child: restart if the flag is true, stop otherwise.
Declaration
public override void ProcessFailure(IActorContext context, bool restart, IActorRef child, Exception cause, ChildRestartStats stats, IReadOnlyCollection<ChildRestartStats> children)
Parameters
Type | Name | Description |
---|---|---|
IActorContext | context | The actor context. |
bool | restart | if set to |
IActorRef | child | The child actor |
Exception | cause | The exception that caused the child to fail. |
ChildRestartStats | stats | The stats for the child that failed. The ActorRef to the child can be obtained via the Child property |
IReadOnlyCollection<ChildRestartStats> | children | The stats for all children |
Overrides
| Edit this page View SourceToSurrogate(ActorSystem)
Creates a surrogate representation of the current AllForOneStrategy.
Declaration
public override ISurrogate ToSurrogate(ActorSystem system)
Parameters
Type | Name | Description |
---|---|---|
ActorSystem | system | The actor system that owns this router. |
Returns
Type | Description |
---|---|
ISurrogate | The surrogate representation of the current AllForOneStrategy. |