Table of Contents

Class DefaultRetryPolicy

Namespace
Amazon.Runtime.Internal
Assembly
AWSSDK.Core.dll

The default implementation of the legacy retry policy.

public class DefaultRetryPolicy : RetryPolicy
Inheritance
DefaultRetryPolicy
Inherited Members

Constructors

DefaultRetryPolicy(IClientConfig)

Constructor for DefaultRetryPolicy.

public DefaultRetryPolicy(IClientConfig config)

Parameters

config IClientConfig

The Client config object. This is used to retrieve the maximum number of retries before throwing back a exception(This does not count the initial request) and the service URL for the request.

DefaultRetryPolicy(int)

Constructor for DefaultRetryPolicy.

public DefaultRetryPolicy(int maxRetries)

Parameters

maxRetries int

The maximum number of retries before throwing back a exception. This does not count the initial request.

Properties

MaxBackoffInMilliseconds

The maximum value of exponential backoff in milliseconds, which will be used to wait before retrying a request. The default is 30000 milliseconds.

public int MaxBackoffInMilliseconds { get; set; }

Property Value

int

Methods

CanRetry(IExecutionContext)

Returns true if the request is in a state where it can be retried, else false.

public override bool CanRetry(IExecutionContext executionContext)

Parameters

executionContext IExecutionContext

Request context containing the state of the request.

Returns

bool

Returns true if the request is in a state where it can be retried, else false.

ContainErrorMessage(Exception)

[Obsolete("This method is no longer used within DefaultRetryPolicy")]
protected static bool ContainErrorMessage(Exception exception)

Parameters

exception Exception

Returns

bool

IsInnerException<T>(Exception)

[Obsolete("This method has been moved to AWSSDK.Runtime.Internal.Util.ExceptionUtils")]
protected static bool IsInnerException<T>(Exception exception) where T : Exception

Parameters

exception Exception

Returns

bool

Type Parameters

T

IsInnerException<T>(Exception, out T)

[Obsolete("This method has been moved to AWSSDK.Runtime.Internal.Util.ExceptionUtils")]
protected static bool IsInnerException<T>(Exception exception, out T inner) where T : Exception

Parameters

exception Exception
inner T

Returns

bool

Type Parameters

T

NotifySuccess(IExecutionContext)

Virtual method that gets called on a success Response. If its a retry success response, the entire retry acquired capacity is released(default is 5). If its just a success response a lesser value capacity is released(default is 1).

public override void NotifySuccess(IExecutionContext executionContext)

Parameters

executionContext IExecutionContext

Request context containing the state of the request.

OnRetry(IExecutionContext)

Virtual method that gets called when a retry request is initiated. If retry throttling is enabled, the value returned is true if the required capacity is retured, false otherwise. If retry throttling is disabled, true is returned.

public override bool OnRetry(IExecutionContext executionContext)

Parameters

executionContext IExecutionContext

The execution context which contains both the requests and response context.

Returns

bool

OnRetry(IExecutionContext, bool)

Virtual method that gets called when a retry request is initiated. If retry throttling is enabled, the value returned is true if the required capacity is retured, false otherwise. If retry throttling is disabled, true is returned.

public override bool OnRetry(IExecutionContext executionContext, bool bypassAcquireCapacity)

Parameters

executionContext IExecutionContext

The execution context which contains both the requests and response context.

bypassAcquireCapacity bool

true to bypass any attempt to acquire capacity on a retry

Returns

bool

OnRetry(IExecutionContext, bool, bool)

Virtual method that gets called when a retry request is initiated. If retry throttling is enabled, the value returned is true if the required capacity is retured, false otherwise. If retry throttling is disabled, true is returned.

public override bool OnRetry(IExecutionContext executionContext, bool bypassAcquireCapacity, bool isThrottlingError)

Parameters

executionContext IExecutionContext

The execution context which contains both the requests and response context.

bypassAcquireCapacity bool

true to bypass any attempt to acquire capacity on a retry

isThrottlingError bool

true if the error that will be retried is a throtting error

Returns

bool

RetryForException(IExecutionContext, Exception)

Return true if the request should be retried.

public override bool RetryForException(IExecutionContext executionContext, Exception exception)

Parameters

executionContext IExecutionContext

Request context containing the state of the request.

exception Exception

The exception thrown by the previous request.

Returns

bool

Return true if the request should be retried.

RetryForExceptionAsync(IExecutionContext, Exception)

Return true if the request should be retried.

public override Task<bool> RetryForExceptionAsync(IExecutionContext executionContext, Exception exception)

Parameters

executionContext IExecutionContext

Request context containing the state of the request.

exception Exception

The exception thrown by the previous request.

Returns

Task<bool>

Return true if the request should be retried.

RetryLimitReached(IExecutionContext)

Checks if the retry limit is reached.

public override bool RetryLimitReached(IExecutionContext executionContext)

Parameters

executionContext IExecutionContext

Request context containing the state of the request.

Returns

bool

Return false if the request can be retried, based on number of retries.

WaitBeforeRetry(IExecutionContext)

Waits before retrying a request. The default policy implements a exponential backoff.

public override void WaitBeforeRetry(IExecutionContext executionContext)

Parameters

executionContext IExecutionContext

Request context containing the state of the request.

WaitBeforeRetry(int, int)

Waits for an amount of time using an exponential backoff algorithm.

public static void WaitBeforeRetry(int retries, int maxBackoffInMilliseconds)

Parameters

retries int

The request retry index. The first request is expected to be 0 while the first retry will be 1.

maxBackoffInMilliseconds int

The max number of milliseconds to wait

WaitBeforeRetryAsync(IExecutionContext)

Waits before retrying a request.

public override Task WaitBeforeRetryAsync(IExecutionContext executionContext)

Parameters

executionContext IExecutionContext

The execution context which contains both the requests and response context.

Returns

Task