Class RetryPolicyExtensions
Helper methods for IRetryPolicy.
Inherited Members
Namespace: Unity.Cloud.Common
Assembly: Unity.Cloud.Common.dll
Syntax
public static class RetryPolicyExtensions
Methods
ExecuteAsyncWithExceptionValidation(IRetryPolicy, RetriedOperation, ShouldRetryExceptionChecker, CancellationToken, IProgress<RetryQueuedProgress>)
An async method that can retry an operation if it hasn't succeeded ; validation checking is performed on the exception thrown by the operation.
Declaration
public static Task ExecuteAsyncWithExceptionValidation(this IRetryPolicy retryPolicy, IRetryPolicy.RetriedOperation retriedOperation, IRetryPolicy.ShouldRetryExceptionChecker shouldRetryExceptionChecker, CancellationToken cancellationToken = default, IProgress<RetryQueuedProgress> progress = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IRetryPolicy | retryPolicy | The retry policy. |
| IRetryPolicy.RetriedOperation | retriedOperation | The IRetryPolicy.RetriedOperation that needs to be performed. |
| IRetryPolicy.ShouldRetryExceptionChecker | shouldRetryExceptionChecker | A IRetryPolicy.ShouldRetryExceptionChecker that helps determine whether the |
| CancellationToken | cancellationToken | Token to cancel the task execution. |
| IProgress<RetryQueuedProgress> | progress | Provider for progress updates on queued retries. |
Returns
| Type | Description |
|---|---|
| Task | The result of the |
Exceptions
| Type | Condition |
|---|---|
| RetryExecutionFailedException | When |
| TimeoutException | When the retry policy expires. |
| OperationCanceledException | When the |
ExecuteAsyncWithExceptionValidation<T>(IRetryPolicy, RetriedOperation<T>, ShouldRetryExceptionChecker, CancellationToken, IProgress<RetryQueuedProgress>)
An async method that can retry an operation if it hasn't succeeded ; validation checking is performed on the exception thrown by the operation.
Declaration
public static Task<T> ExecuteAsyncWithExceptionValidation<T>(this IRetryPolicy retryPolicy, IRetryPolicy.RetriedOperation<T> retriedOperation, IRetryPolicy.ShouldRetryExceptionChecker shouldRetryExceptionChecker, CancellationToken cancellationToken = default, IProgress<RetryQueuedProgress> progress = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IRetryPolicy | retryPolicy | The retry policy. |
| IRetryPolicy.RetriedOperation<T> | retriedOperation | The IRetryPolicy.RetriedOperation<T> that needs to be performed. |
| IRetryPolicy.ShouldRetryExceptionChecker | shouldRetryExceptionChecker | A IRetryPolicy.ShouldRetryExceptionChecker that helps determine whether the |
| CancellationToken | cancellationToken | Token to cancel the task execution. |
| IProgress<RetryQueuedProgress> | progress | Provider for progress updates on queued retries. |
Returns
| Type | Description |
|---|---|
| Task<T> | The result of the |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the result for the operation. |
Exceptions
| Type | Condition |
|---|---|
| RetryExecutionFailedException | When |
| TimeoutException | When the retry policy expires. |
| OperationCanceledException | When the |
ExecuteAsyncWithResultValidation<T>(IRetryPolicy, RetriedOperation<T>, ShouldRetryResultChecker<T>, CancellationToken, IProgress<RetryQueuedProgress>)
An async method that can retry an operation if it hasn't succeeded ; validation checking is performed on the result of the operation.
Declaration
public static Task<T> ExecuteAsyncWithResultValidation<T>(this IRetryPolicy retryPolicy, IRetryPolicy.RetriedOperation<T> retriedOperation, IRetryPolicy.ShouldRetryResultChecker<T> shouldRetryResultChecker, CancellationToken cancellationToken = default, IProgress<RetryQueuedProgress> progress = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IRetryPolicy | retryPolicy | The retry policy. |
| IRetryPolicy.RetriedOperation<T> | retriedOperation | The IRetryPolicy.RetriedOperation<T> that needs to be performed. |
| IRetryPolicy.ShouldRetryResultChecker<T> | shouldRetryResultChecker | A IRetryPolicy.ShouldRetryResultChecker<T> that helps determine whether the |
| CancellationToken | cancellationToken | Token to cancel the task execution. |
| IProgress<RetryQueuedProgress> | progress | Provider for progress updates on queued retries. |
Returns
| Type | Description |
|---|---|
| Task<T> | The result of the |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the result for the operation. |
Exceptions
| Type | Condition |
|---|---|
| RetryExecutionFailedException | When |
| TimeoutException | When the retry policy expires. |
| OperationCanceledException | When the |