Exemple #1
0
        public RetryExponential(TimeSpan minimumBackoff, TimeSpan maximumBackoff, int maximumRetryCount)
        {
            TimeoutHelper.ThrowIfNegativeArgument(minimumBackoff, nameof(minimumBackoff));
            TimeoutHelper.ThrowIfNegativeArgument(maximumBackoff, nameof(maximumBackoff));

            this.minimumBackoff    = minimumBackoff;
            this.maximumBackoff    = maximumBackoff;
            this.maximumRetryCount = maximumRetryCount;
        }
Exemple #2
0
        internal RetryExponential(TimeSpan minBackoff, TimeSpan maxBackoff, TimeSpan deltaBackoff, int maxRetryCount)
        {
            TimeoutHelper.ThrowIfNonPositiveArgument(deltaBackoff, nameof(deltaBackoff));
            TimeoutHelper.ThrowIfNegativeArgument(minBackoff, nameof(minBackoff));
            TimeoutHelper.ThrowIfNonPositiveArgument(maxBackoff, nameof(maxBackoff));

            if (maxRetryCount <= 0)
            {
                throw new ArgumentOutOfRangeException(
                          nameof(maxRetryCount),
                          Resources.ArgumentMustBePositive.FormatForUser(nameof(maxRetryCount)));
            }

            if (minBackoff >= maxBackoff)
            {
                throw new ArgumentException(Resources.ExponentialRetryBackoffRange.FormatForUser(minBackoff, maxBackoff));
            }

            this.MinimalBackoff = minBackoff;
            this.MaximumBackoff = maxBackoff;
            this.DeltaBackoff   = deltaBackoff;
            this.MaxRetryCount  = maxRetryCount;
        }
Exemple #3
0
 /// <summary>
 /// Gets a <see cref="SecurityToken"/> for the given audience and duration.
 /// </summary>
 /// <param name="appliesTo">The URI which the access token applies to</param>
 /// <param name="action">The request action</param>
 /// <param name="timeout">The time span that specifies the timeout value for the message that gets the security token</param>
 /// <returns></returns>
 public Task <SecurityToken> GetTokenAsync(string appliesTo, string action, TimeSpan timeout)
 {
     TimeoutHelper.ThrowIfNegativeArgument(timeout);
     appliesTo = this.NormalizeAppliesTo(appliesTo);
     return(this.OnGetTokenAsync(appliesTo, action, timeout));
 }