/// <summary> /// </summary> /// <param name="millisecDelayBetweenRetries">Optional delay in milliseconds between retries.</param> /// <param name="optionalFailureDetector">Optional custom method to decide whether failure occurred and retry is required. If not provided, exception in the main method or result post-processing will trigger retry.</param> protected RetryAspectBase(uint millisecDelayBetweenRetries, FailureDetectorDelegate optionalFailureDetector) { this.MillisecDelayBetweenRetries = millisecDelayBetweenRetries; this.OptionalFailureDetector = optionalFailureDetector; }
/// <summary> /// </summary> /// <param name="keepTryingForMilliseconds">Time period during which attempts will be made to call intercepted method.</param> /// <param name="millisecDelayBetweenRetries"></param> /// <param name="optionalFailureDetector">Optional custom method to decide whether failure occurred and retry is required. If not provided, exception in the main method or result post-processing will trigger retry.</param> public RetryTimeAspect(uint keepTryingForMilliseconds, uint millisecDelayBetweenRetries = 0, FailureDetectorDelegate optionalFailureDetector = null) : base(millisecDelayBetweenRetries, optionalFailureDetector) { this.KeepTryingForMilliseconds = keepTryingForMilliseconds; }
/// <summary> /// /// </summary> /// <param name="keepTryingForMilliseconds">Maximum amount of time to keep retrying for, after which failure is considered permanent.</param> /// <param name="initialMillisecDelayBetweenRetries">Delay after first failed attempt. Delay between subsequent attempts will grow.</param> /// <param name="delayMultiplier">Multiplier determining growth of delay between subsequent attempts.</param> /// <param name="optionalFailureDetector">Optional custom method to decide whether failure occurred and retry is required. If not provided, exception in the main method or result post-processing will trigger retry.</param> public RetryExponentialDelayAspect(uint keepTryingForMilliseconds, uint initialMillisecDelayBetweenRetries = 1, double delayMultiplier = 2.0, FailureDetectorDelegate optionalFailureDetector = null) : base(keepTryingForMilliseconds, initialMillisecDelayBetweenRetries == 0 ? 1 : initialMillisecDelayBetweenRetries, optionalFailureDetector) { if (delayMultiplier <= 1) { throw new ArgumentException("delayMultiplier has to be greater than 1. {0} is an invalid value.".SmartFormat(delayMultiplier)); } this.DelayMultiplier = delayMultiplier; }
/// <summary> /// </summary> /// <param name="retryCount">Maximum number of attempts to call the function</param> /// <param name="millisecDelayBetweenRetries"></param> /// <param name="optionalFailureDetector">Optional custom method to decide whether failure occurred and retry is required. If not provided, exception in the main method or result post-processing will trigger retry.</param> public RetryCountAspect(byte retryCount, uint millisecDelayBetweenRetries = 0, FailureDetectorDelegate optionalFailureDetector = null) : base(millisecDelayBetweenRetries, optionalFailureDetector) { this.RetryCount = retryCount; }
/// <summary> /// /// </summary> /// <param name="keepTryingForMilliseconds">Maximum amount of time to keep retrying for, after which failure is considered permanent.</param> /// <param name="initialMillisecDelayBetweenRetries">Delay after first failed attempt. Delay between subsequent attempts will grow.</param> /// <param name="delayMultiplier">Multiplier determining growth of delay between subsequent attempts.</param> /// <param name="optionalFailureDetector">Optional custom method to decide whether failure occurred and retry is required. If not provided, exception in the main method or result post-processing will trigger retry.</param> public RetryExponentialDelayAspect(uint keepTryingForMilliseconds, uint initialMillisecDelayBetweenRetries = 1, double delayMultiplier = 2.0, FailureDetectorDelegate optionalFailureDetector = null) : base(keepTryingForMilliseconds, initialMillisecDelayBetweenRetries == 0 ? 1 : initialMillisecDelayBetweenRetries, optionalFailureDetector) { if(delayMultiplier <= 1) throw new ArgumentException("delayMultiplier has to be greater than 1. {0} is an invalid value.".SmartFormat(delayMultiplier)); this.DelayMultiplier = delayMultiplier; }