Click or drag to resize

LinearRetryPolicy Class

Implements a simple IRetryPolicy that retries an operation at a fixed interval for a specified maximum number of times.
Inheritance Hierarchy

Namespace:  Neon.Retry
Assembly:  Neon.Common (in Neon.Common.dll) Version: 2.2.0
Syntax
public class LinearRetryPolicy : RetryPolicyBase, 
	IRetryPolicy

The LinearRetryPolicy type exposes the following members.

Constructors
  NameDescription
Public methodLinearRetryPolicy(FuncException, Boolean, Int32, NullableTimeSpan, NullableTimeSpan, String)
Constructs the retry policy with a specific transitent detection function.d
Public methodLinearRetryPolicy(Type, Int32, NullableTimeSpan, NullableTimeSpan, String)
Constructs the retry policy to handle a specific exception type as transient.
Public methodLinearRetryPolicy(Type, Int32, NullableTimeSpan, NullableTimeSpan, String)
Constructs the retry policy to handle a multiple exception types as transient.
Top
Properties
  NameDescription
Public propertyMaxAttempts
Returns the maximum number of times the action should be attempted.
Public propertyRetryInterval
Returns the fixed interval between action retry attempts.
Protected propertySourceModule
Returns the source module.
(Inherited from RetryPolicyBase.)
Public propertyTimeout
Returns the optional policy timeout. When present, this specifies the maximum time the policy will continue retrying the operation.
(Inherited from RetryPolicyBase.)
Top
Methods
  NameDescription
Protected methodAdjustDelay
Adjusts the delay TimeSpan passed to ensure such that delaying the next retry won't exceed the overall retry timeout (if specified).
(Inherited from RetryPolicyBase.)
Public methodClone
Returns a copy of the retry policy.
(Overrides RetryPolicyBaseClone(FuncException, Boolean).)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodInvokeAsync(FuncTask)
Retries an action that returns no result when it throws exceptions due to transient errors. The classification of what is a transient error, the interval between the retries as well as the number of times the operation are retried are determined by the policy implementation.
(Overrides RetryPolicyBaseInvokeAsync(FuncTask).)
Public methodInvokeAsyncTResult(FuncTaskTResult)
Retries an action that returns TResult when it throws exceptions due to transient errors. he classification of what is a transient error, the interval between the retries as well as the number of times the operation are retried are determined by the policy implementation.
(Overrides RetryPolicyBaseInvokeAsyncTResult(FuncTaskTResult).)
Public methodInvokeAsyncTResult(FuncTaskTResult)
Retries an action that returns TResult when it throws exceptions due to transient errors. he classification of what is a transient error, the interval between the retries as well as the number of times the operation are retried are determined by the policy implementation.
(Inherited from RetryPolicyBase.)
Protected methodLogTransient
Logs a transient exception that will be retried if logging is enabled.
(Inherited from RetryPolicyBase.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodSysDeadline
Computes the time (SYS) after which the operation should not be retried.
(Inherited from RetryPolicyBase.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Remarks

You can enable transient error logging by passing a non-empty logCategory name to the constructor. This creates an embedded INeonLogger using that name and any retried transient errors will then be logged as warnings including [transient-retry] in the message.

Note Note
Only the retried errors will be logged. The final exception thrown after all retries fail will not be logged because it's assumed that these will be caught and handled upstack by application code.

Choose a category name that can be used to easily identify the affected component. For example, couchbase:my-cluster to identify a specific Couchbase cluster.

See Also