コード例 #1
0
        public void BackoffExponential()
        {
            var random = new Random();
            var min    = random.Next(1, 100);
            var max    = random.Next(101, 1000);
            var t      = Strategies.Backoff(Strategy.Exponential, min, max);

            Assert.IsNotNull(t as BackoffTiming);
            Assert.IsNotNull(t.Timing as ExponentialTiming);
        }
コード例 #2
0
        public void BackoffLinear()
        {
            var random = new Random();
            var min    = random.Next(1, 100);
            var max    = random.Next(101, 1000);
            var t      = Strategies.Backoff(Strategy.Linear, min, max);

            Assert.IsNotNull(t as BackoffTiming);
            Assert.IsNotNull(t.Timing as LinearTiming);
        }
コード例 #3
0
ファイル: BackoffTask.cs プロジェクト: zheng1748/King.Service
 /// <summary>
 /// Default Constructor
 /// </summary>
 /// <param name="minimumPeriodInSeconds">Minimum, time in seconds</param>
 /// <param name="maximumPeriodInSeconds">Maximum, time in seconds</param>
 /// <param name="strategy">Timing Strategy</param>
 public BackoffTask(int minimumPeriodInSeconds = BaseTimes.DefaultMinimumTiming, int maximumPeriodInSeconds = BaseTimes.DefaultMaximumTiming, Strategy strategy = Strategy.Exponential)
     : base(Strategies.Backoff(strategy, minimumPeriodInSeconds, maximumPeriodInSeconds))
 {
 }