public virtual void TestParsePeriod() { // By default scheduler = new DecayRpcScheduler(1, string.Empty, new Configuration()); Assert.Equal(DecayRpcScheduler.IpcCallqueueDecayschedulerPeriodDefault , scheduler.GetDecayPeriodMillis()); // Custom Configuration conf = new Configuration(); conf.SetLong("ns." + DecayRpcScheduler.IpcCallqueueDecayschedulerPeriodKey, 1058); scheduler = new DecayRpcScheduler(1, "ns", conf); Assert.Equal(1058L, scheduler.GetDecayPeriodMillis()); }
/// <exception cref="System.Exception"/> public virtual void TestPeriodic() { Configuration conf = new Configuration(); conf.Set("ns." + DecayRpcScheduler.IpcCallqueueDecayschedulerPeriodKey, "10"); conf.Set("ns." + DecayRpcScheduler.IpcCallqueueDecayschedulerFactorKey, "0.5"); scheduler = new DecayRpcScheduler(1, "ns", conf); Assert.Equal(10, scheduler.GetDecayPeriodMillis()); Assert.Equal(0, scheduler.GetTotalCallSnapshot()); for (int i = 0; i < 64; i++) { scheduler.GetPriorityLevel(MockCall("A")); } // It should eventually decay to zero while (scheduler.GetTotalCallSnapshot() > 0) { Thread.Sleep(10); } }