try { executionThreads.add(Thread.currentThread()); TestThreadIsolationWithSemaphoreSetSmallCommand command3 = new TestThreadIsolationWithSemaphoreSetSmallCommand(circuitBreaker, 2, new Action0() { results.add(command3.toObservable().map(new Func1<Boolean, Boolean>() {
try { executionThreads.add(Thread.currentThread()); TestThreadIsolationWithSemaphoreSetSmallCommand command1 = new TestThreadIsolationWithSemaphoreSetSmallCommand(circuitBreaker, 2, new Action0() { results.add(command1.toObservable().map(new Func1<Boolean, Boolean>() {
try { executionThreads.add(Thread.currentThread()); TestThreadIsolationWithSemaphoreSetSmallCommand command2 = new TestThreadIsolationWithSemaphoreSetSmallCommand(circuitBreaker, 2, new Action0() { results.add(command2.toObservable().map(new Func1<Boolean, Boolean>() {
private TestThreadIsolationWithSemaphoreSetSmallCommand(TestCircuitBreaker circuitBreaker, int poolSize, Action0 action) { super(testPropsBuilder().setCircuitBreaker(circuitBreaker).setMetrics(circuitBreaker.metrics) .setThreadPoolKey(HystrixThreadPoolKey.Factory.asKey(TestThreadIsolationWithSemaphoreSetSmallCommand.class.getSimpleName())) .setThreadPoolPropertiesDefaults(HystrixThreadPoolPropertiesTest.getUnitTestPropertiesBuilder() .withCoreSize(poolSize).withMaximumSize(poolSize).withMaxQueueSize(0)) .setCommandPropertiesDefaults(HystrixCommandPropertiesTest.getUnitTestPropertiesSetter() .withExecutionIsolationStrategy(ExecutionIsolationStrategy.THREAD) .withExecutionIsolationSemaphoreMaxConcurrentRequests(1))); this.action = action; }