Exemplo n.º 1
0
 private void StopExecute()
 {
     if (ExecuteFiber != null)
     {
         ExecuteFiber.Dispose();
         ExecuteFiber = new PoolFiber();
     }
 }
Exemplo n.º 2
0
 private void StopService()
 {
     if (ServiceFiber != null)
     {
         ServiceFiber.Stop();
         ServiceFiber.Dispose();
         ServiceFiber = new PoolFiber();
     }
 }
        protected override void TearDown()
        {
            log.InfoFormat("TearDown: serverId={0}", ServerId);
            if (this.MasterPeer != null)
            {
                this.MasterPeer.Disconnect();
            }

            if (executionFiber != null)
            {
                executionFiber.Dispose();
                executionFiber = null;
            }

            Update();
        }
Exemplo n.º 4
0
        public void ShouldIncreasePoolFiberSubscriberCountByOne()
        {
            var fiber = new PoolFiber();

            fiber.Start();
            var channel = new Channel <int>();

            Assert.AreEqual(0, fiber.NumSubscriptions);
            Assert.AreEqual(0, channel.NumSubscribers);
            channel.Subscribe(fiber, x => { });

            Assert.AreEqual(1, fiber.NumSubscriptions);
            Assert.AreEqual(1, channel.NumSubscribers);
            fiber.Dispose();

            Assert.AreEqual(0, fiber.NumSubscriptions);
            Assert.AreEqual(0, channel.NumSubscribers);
        }
Exemplo n.º 5
0
        public void BasicPubSubWithPoolQueue()
        {
            IFiber queue = new PoolFiber();

            queue.Start();
            Channel <string> hello  = new Channel <string>();
            Channel <string> hello2 = new Channel <string>();

            AutoResetEvent  reset        = new AutoResetEvent(false);
            Action <string> receiveHello = delegate(string str)
            {
                Assert.AreEqual("hello", str);
                reset.Set();
            };

            hello.Subscribe(queue, receiveHello);
            hello2.Subscribe(queue, receiveHello);
            Assert.IsTrue(hello.Publish("hello"));
            Assert.IsTrue(reset.WaitOne(10000, false));
            queue.Dispose();
        }
Exemplo n.º 6
0
 /// <summary>
 ///  Stops all timers.
 /// </summary>
 public void Stop()
 {
     fiber.Dispose();
     fiber   = new PoolFiber();
     running = false;
 }