Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Hyak.Common.TransientFaultHandling.RetryPolicy" /> class with the specified number of retry attempts and parameters defining the progressive delay between retries.
 /// </summary>
 /// <param name="errorDetectionStrategy">The <see cref="T:Hyak.Common.TransientFaultHandling.ITransientErrorDetectionStrategy" /> that is responsible for detecting transient conditions.</param>
 /// <param name="retryStrategy">The strategy to use for this retry policy.</param>
 public RetryPolicy(ITransientErrorDetectionStrategy errorDetectionStrategy, RetryStrategy retryStrategy)
 {
     Guard.ArgumentNotNull(errorDetectionStrategy, "errorDetectionStrategy");
     Guard.ArgumentNotNull(retryStrategy, "retryPolicy");
     ErrorDetectionStrategy = errorDetectionStrategy;
     if (errorDetectionStrategy == null)
     {
         throw new InvalidOperationException("The error detection strategy type must implement the ITransientErrorDetectionStrategy interface.");
     }
     RetryStrategy = retryStrategy;
 }
Esempio n. 2
0
 static RetryStrategy()
 {
     DefaultClientRetryCount = 10;
     DefaultClientBackoff    = TimeSpan.FromSeconds(10);
     DefaultMaxBackoff       = TimeSpan.FromSeconds(30);
     DefaultMinBackoff       = TimeSpan.FromSeconds(1);
     DefaultRetryInterval    = TimeSpan.FromSeconds(1);
     DefaultRetryIncrement   = TimeSpan.FromSeconds(1);
     DefaultFirstFastRetry   = true;
     NoRetry            = new FixedInterval(0, DefaultRetryInterval);
     DefaultFixed       = new FixedInterval(DefaultClientRetryCount, DefaultRetryInterval);
     DefaultProgressive = new Incremental(DefaultClientRetryCount, DefaultRetryInterval, DefaultRetryIncrement);
     DefaultExponential = new ExponentialBackoff(DefaultClientRetryCount, DefaultMinBackoff, DefaultMaxBackoff, DefaultClientBackoff);
 }
Esempio n. 3
0
 public RetryPolicy(RetryStrategy retryStrategy)
     : base(default(T) == null ? Activator.CreateInstance <T>() : default(T), retryStrategy)
 {
 }