private void StopExecute() { if (ExecuteFiber != null) { ExecuteFiber.Dispose(); ExecuteFiber = new PoolFiber(); } }
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(); }
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); }
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(); }
/// <summary> /// Stops all timers. /// </summary> public void Stop() { fiber.Dispose(); fiber = new PoolFiber(); running = false; }