private StpIsolationThreadPool CreateAndStartPool(int threadCount, int queueLength)
 {
     var pool = new StpIsolationThreadPool(
         GroupKey.Named("Test"),
         new TransientConfigurableValue<int>(threadCount),
         new TransientConfigurableValue<int>(queueLength),
         new IgnoringStats());
     pool.Start();
     return pool;
 }
示例#2
0
        private StpIsolationThreadPool CreateAndStartPool(int threadCount, int queueLength)
        {
            var pool = new StpIsolationThreadPool(
                GroupKey.Named("Test"),
                new TransientConfigurableValue <int>(threadCount),
                new TransientConfigurableValue <int>(queueLength),
                new IgnoringStats());

            pool.Start();
            return(pool);
        }
        public void Start_Elapsed()
        {
            var mockStats = new Mock<IStats>();
            var pool = new StpIsolationThreadPool(
                GroupKey.Named("Test"),
                new TransientConfigurableValue<int>(10),
                new TransientConfigurableValue<int>(20),
                mockStats.Object);

            pool.Start();

            mockStats.Verify(m => m.Elapsed("mjolnir pool Test Start", null, It.IsAny<TimeSpan>()), Times.Once);
        }
        public void Start_Elapsed()
        {
            var mockStats = new Mock <IStats>();
            var pool      = new StpIsolationThreadPool(
                GroupKey.Named("Test"),
                new TransientConfigurableValue <int>(10),
                new TransientConfigurableValue <int>(20),
                mockStats.Object);

            pool.Start();

            mockStats.Verify(m => m.Elapsed("mjolnir pool Test Start", null, It.IsAny <TimeSpan>()), Times.Once);
        }
        public void Enqueue_Elapsed()
        {
            var mockStats = new Mock<IStats>();
            var mockMetricEvents = new Mock<IMetricEvents>();
            var pool = new StpIsolationThreadPool(
                GroupKey.Named("Test"),
                new TransientConfigurableValue<int>(10),
                new TransientConfigurableValue<int>(20),
                mockStats.Object,
                mockMetricEvents.Object);
            pool.Start();

            pool.Enqueue<object>(() => new { });

            mockStats.Verify(m => m.Elapsed("mjolnir pool Test Enqueue", "Enqueued", It.IsAny<TimeSpan>()), Times.Once);
        }