docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class RetryPolicyExtensions

    Helper methods for IRetryPolicy.

    Inheritance
    object
    RetryPolicyExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    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 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.

    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 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

    The type of the result for the operation.

    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, 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 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

    The type of the result for the operation.

    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.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)