Class OneForOneStrategy
This class represents a fault handling strategy that applies a Directive to the single child actor that failed.
Inheritance
Inherited Members
Namespace: Akka.Actor
Assembly: Akka.dll
Syntax
public class OneForOneStrategy : SupervisorStrategy, ISurrogated, IEquatable<OneForOneStrategy>
Constructors
| Edit this page View SourceOneForOneStrategy()
Initializes a new instance of the OneForOneStrategy class.
Declaration
protected OneForOneStrategy()
OneForOneStrategy(IDecider)
Initializes a new instance of the OneForOneStrategy class.
Declaration
public OneForOneStrategy(IDecider decider)
Parameters
| Type | Name | Description |
|---|---|---|
| IDecider | decider | TBD |
OneForOneStrategy(Func<Exception, Directive>)
Initializes a new instance of the OneForOneStrategy class.
Declaration
public OneForOneStrategy(Func<Exception, Directive> localOnlyDecider)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<Exception, Directive> | localOnlyDecider | mapping from Exception to Directive |
OneForOneStrategy(Func<Exception, Directive>, bool)
Initializes a new instance of the OneForOneStrategy class.
Declaration
public OneForOneStrategy(Func<Exception, Directive> localOnlyDecider, bool loggingEnabled = true)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<Exception, Directive> | localOnlyDecider | |
| bool | loggingEnabled | If |
OneForOneStrategy(int, int, IDecider, bool)
Initializes a new instance of the OneForOneStrategy class.
Declaration
public OneForOneStrategy(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 |
OneForOneStrategy(int, int, Func<Exception, Directive>, bool)
Initializes a new instance of the OneForOneStrategy class.
Declaration
public OneForOneStrategy(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 |
OneForOneStrategy(int?, TimeSpan?, IDecider)
Initializes a new instance of the OneForOneStrategy class.
Declaration
public OneForOneStrategy(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 means no limit, if the limit is exceeded the child actor is stopped. |
| TimeSpan? | withinTimeRange | duration of the time window for maxNrOfRetries, System.Threading.Timeout.InfiniteTimeSpan means no window. |
| IDecider | decider |
OneForOneStrategy(int?, TimeSpan?, Func<Exception, Directive>)
Initializes a new instance of the OneForOneStrategy class.
Declaration
public OneForOneStrategy(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 means no limit, if the limit is exceeded the child actor is stopped. |
| TimeSpan? | withinTimeRange | duration of the time window for |
| 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(OneForOneStrategy)
Declaration
public bool Equals(OneForOneStrategy other)
Parameters
| Type | Name | Description |
|---|---|---|
| OneForOneStrategy | 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>)
TBD
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>)
TBD
Declaration
public override void ProcessFailure(IActorContext context, bool restart, IActorRef child, Exception cause, ChildRestartStats stats, IReadOnlyCollection<ChildRestartStats> children)
Parameters
| Type | Name | Description |
|---|---|---|
| IActorContext | context | TBD |
| bool | restart | TBD |
| IActorRef | child | TBD |
| Exception | cause | TBD |
| ChildRestartStats | stats | TBD |
| IReadOnlyCollection<ChildRestartStats> | children | TBD |
Overrides
| Edit this page View SourceToSurrogate(ActorSystem)
Creates a surrogate representation of the current OneForOneStrategy.
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 OneForOneStrategy. |
Overrides
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | This exception is thrown if the Decider is of type LocalOnlyDecider. |
WithMaxNrOfRetries(int)
Declaration
public OneForOneStrategy WithMaxNrOfRetries(int maxNrOfRetries)
Parameters
| Type | Name | Description |
|---|---|---|
| int | maxNrOfRetries |
Returns
| Type | Description |
|---|---|
| OneForOneStrategy |
Edit this page