@Test public void testThreadPoolSizeDefault() { HystrixTimer hystrixTimer = HystrixTimer.getInstance(); hystrixTimer.startThreadIfNeeded(); assertEquals(Runtime.getRuntime().availableProcessors(), hystrixTimer.executor.get().getThreadPool().getCorePoolSize()); }
@Test public void testThreadPoolSizeConfiguredWithBuilder() { HystrixTimerThreadPoolProperties.Setter builder = HystrixTimerThreadPoolProperties.Setter().withCoreSize(1); final HystrixTimerThreadPoolProperties props = new HystrixTimerThreadPoolProperties(builder) { }; HystrixPropertiesStrategy strategy = new HystrixPropertiesStrategy() { @Override public HystrixTimerThreadPoolProperties getTimerThreadPoolProperties() { return props; } }; HystrixPlugins.getInstance().registerPropertiesStrategy(strategy); HystrixTimer hystrixTimer = HystrixTimer.getInstance(); hystrixTimer.startThreadIfNeeded(); assertEquals(1, hystrixTimer.executor.get().getThreadPool().getCorePoolSize()); }