public virtual void Dispose() { if (this.context != null) { this.context.Dispose(); this.context = null; } HystrixThreadPoolFactory.Shutdown(); }
public static void Reset(TimeSpan timeout) { HystrixThreadPoolFactory.Shutdown(timeout); HystrixCommandMetrics.Reset(); //HystrixCollapser.Reset(); HystrixCircuitBreakerFactory.Reset(); HystrixPlugins.Reset(); //HystrixPropertiesFactory.reset(); //currentCommand.set(new LinkedList<HystrixCommandKey>()); }
public void TestShutdown() { // other unit tests will probably have run before this so get the count int count = HystrixThreadPoolFactory.threadPools.Count; IHystrixThreadPool pool = HystrixThreadPoolFactory.GetInstance(HystrixThreadPoolKeyDefault.AsKey("threadPoolFactoryTest"), HystrixThreadPoolOptionsTest.GetUnitTestPropertiesBuilder()); Assert.Equal(count + 1, HystrixThreadPoolFactory.threadPools.Count); Assert.False(pool.GetScheduler().IsShutdown); HystrixThreadPoolFactory.Shutdown(); // ensure all pools were removed from the cache Assert.Equal(0, HystrixThreadPoolFactory.threadPools.Count); Assert.True(pool.GetScheduler().IsShutdown); }
public void ThreadPool_ShutdownWithWait() { // other unit tests will probably have run before this so get the count int count = HystrixThreadPoolFactory.ThreadPoolCount; IHystrixThreadPool pool = HystrixThreadPoolFactory.GetInstance("threadPoolFactoryTest", UnitTestSetterFactory.GetThreadPoolPropertiesSetter()); Assert.AreEqual(count + 1, HystrixThreadPoolFactory.ThreadPoolCount); Assert.IsFalse(pool.Executor.IsShutdown); HystrixThreadPoolFactory.Shutdown(TimeSpan.FromSeconds(1.0)); // ensure all pools were removed from the cache Assert.AreEqual(0, HystrixThreadPoolFactory.ThreadPoolCount); Assert.IsTrue(pool.Executor.IsShutdown); }
public virtual void Dispose() { HystrixThreadPoolFactory.Shutdown(); }