/// <summary> /// Creates a new instance of the <see cref="RetryPolicy"/> type. /// </summary> /// <param name="maxAttempts">The maximum number of times an operation should be retried, must be positive.</param> /// <param name="waitingPolicy">The waiting policy to use, cannot be null.</param> /// <param name="defaultErrorDetectionStrategy">The default error detection strategy to use, cannot be null.</param> /// <param name="useFastRetriesForTesting">A flag indicating if we should use fast retries for testing, default is False</param> /// <exception cref="ArgumentNullException">If some of the non-nullable arguments are null.</exception> /// <exception cref="ArgumentOutOfRangeException"> /// If the <paramref name="maxAttempts"/> argument is not positive. /// </exception> public RetryPolicy(int maxAttempts, WaitingPolicy waitingPolicy, ITransientErrorDetectionStrategy defaultErrorDetectionStrategy, bool useFastRetriesForTesting = false) { // Check the pre-conditions Guard.ArgumentNotZeroOrNegativeValue(maxAttempts, "maxAttempts"); Guard.ArgumentNotNull(waitingPolicy, "waitingPolicy"); Guard.ArgumentNotNull(defaultErrorDetectionStrategy, "defaultErrorDetectionStrategy"); // Assign the fields MaxAttempts = maxAttempts; WaitingPolicy = waitingPolicy; DefaultErrorDetectionStrategy = defaultErrorDetectionStrategy; UseFastRetriesForTesting = useFastRetriesForTesting; }
/// <summary> /// Creates a new instance of the <see cref="FabricClientRetryPolicy"/> type. /// </summary> /// <param name="maxAttempts">The maximum number of times an operation should be retried, must be positive.</param> /// <param name="waitingPolicy">The waiting policy to use, cannot be null.</param> /// <param name="defaultErrorDetectionStrategy">The default error detection strategy to use, cannot be null.</param> /// <param name="useFastRetriesForTesting">A flag indicating if we should use fast retries for testing, default is False</param> /// <exception cref="ArgumentNullException">If some of the non-nullable arguments are null.</exception> /// <exception cref="ArgumentOutOfRangeException">If the <paramref name="maxAttempts"/> argument is not positive.</exception> public FabricClientRetryPolicy(int maxAttempts, WaitingPolicy waitingPolicy, ITransientErrorDetectionStrategy defaultErrorDetectionStrategy, bool useFastRetriesForTesting = false) { // Check the pre-conditions Guard.ArgumentNotZeroOrNegativeValue(maxAttempts, nameof(maxAttempts)); Guard.ArgumentNotNull(waitingPolicy, nameof(waitingPolicy)); Guard.ArgumentNotNull(defaultErrorDetectionStrategy, nameof(defaultErrorDetectionStrategy)); // Assign the fields Client = CreateClient(); MaxAttempts = maxAttempts; WaitingPolicy = waitingPolicy; DefaultErrorDetectionStrategy = defaultErrorDetectionStrategy; UseFastRetriesForTesting = useFastRetriesForTesting; }