docs.unity3d.com
    Show / Hide Table of Contents

    Class RetryPolicyExtensions

    Inheritance
    Object
    RetryPolicyExtensions
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.Cloud.Common
    Syntax
    public static class RetryPolicyExtensions

    Methods

    ExecuteAsyncWithExceptionValidation(IRetryPolicy, IRetryPolicy.RetriedOperation, IRetryPolicy.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(CancellationToken), IProgress<RetryQueuedProgress> progress = null)
    Parameters
    Type Name Description
    IRetryPolicy retryPolicy
    IRetryPolicy.RetriedOperation retriedOperation

    The IRetryPolicy.RetriedOperation that needs to be performed.

    IRetryPolicy.ShouldRetryExceptionChecker shouldRetryExceptionChecker

    A IRetryPolicy.ShouldRetryExceptionChecker that helps determine whether the retriedOperation should be retried, based on its exception.

    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 retriedOperation, after shouldRetryExceptionChecker returns false.

    Exceptions
    Type Condition
    RetryExecutionFailedException

    When shouldRetryExceptionChecker returns false after retriedOperation throws an exception. The internal exception is passed through the former's innerException field.

    TimeoutException

    When the retry policy expires.

    OperationCanceledException

    When the retriedOperation or the cancellationToken is cancelled.

    InvalidArgumentException
    • When shouldRetryChecker throws an invalid exception.
    • When shouldRetryChecker does not await the completion of operationTask.

    ExecuteAsyncWithExceptionValidation<T>(IRetryPolicy, IRetryPolicy.RetriedOperation<T>, IRetryPolicy.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(CancellationToken), IProgress<RetryQueuedProgress> progress = null)
    Parameters
    Type Name Description
    IRetryPolicy retryPolicy
    IRetryPolicy.RetriedOperation<T> retriedOperation

    The IRetryPolicy.RetriedOperation<T> that needs to be performed.

    IRetryPolicy.ShouldRetryExceptionChecker shouldRetryExceptionChecker

    A IRetryPolicy.ShouldRetryExceptionChecker that helps determine whether the retriedOperation should be retried, based on its exception.

    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 retriedOperation, after shouldRetryExceptionChecker returns false.

    Type Parameters
    Name Description
    T
    Exceptions
    Type Condition
    RetryExecutionFailedException

    When shouldRetryExceptionChecker returns false after retriedOperation throws an exception. The internal exception is passed through the former's innerException field.

    TimeoutException

    When the retry policy expires.

    OperationCanceledException

    When the retriedOperation or the cancellationToken is cancelled.

    ExecuteAsyncWithResultValidation<T>(IRetryPolicy, IRetryPolicy.RetriedOperation<T>, IRetryPolicy.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(CancellationToken), IProgress<RetryQueuedProgress> progress = null)
    Parameters
    Type Name Description
    IRetryPolicy retryPolicy
    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 retriedOperation should be retried, based on its result.

    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 retriedOperation, after shouldRetryResultChecker returns false.

    Type Parameters
    Name Description
    T
    Exceptions
    Type Condition
    RetryExecutionFailedException

    When retriedOperation throws an exception, regardless of the result of shouldRetryResultChecker. The internal exception is passed through the former's innerException field.

    TimeoutException

    When the retry policy expires.

    OperationCanceledException

    When the retriedOperation or the cancellationToken is cancelled.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023