use of com.netflix.hystrix.strategy.concurrency.HystrixContextScheduler in project Hystrix by Netflix.
the class HystrixObservableCommandTest method testRejectionWithFallbackRequestContextWithSemaphoreIsolatedAsynchronousObservableAndCapturedContextScheduler.
/**
* Async Observable and semaphore isolation WITH functioning RequestContext
*
* Use HystrixContextScheduler to make the user provided scheduler capture context.
*/
@Test
public void testRejectionWithFallbackRequestContextWithSemaphoreIsolatedAsynchronousObservableAndCapturedContextScheduler() {
RequestContextTestResults results = testRequestContextOnRejectionWithFallback(ExecutionIsolationStrategy.SEMAPHORE, new HystrixContextScheduler(Schedulers.newThread()));
// the user scheduler captures context
assertTrue(results.isContextInitialized.get());
// the user provided thread/scheduler
assertTrue(results.originThread.get().getName().startsWith("RxNewThread"));
// the user scheduler captures context
assertTrue(results.isContextInitializedObserveOn.get());
// the user provided thread/scheduler
assertTrue(results.observeOnThread.get().getName().startsWith("RxNewThread"));
// semaphore isolated
assertFalse(results.command.isExecutedInThread());
}
Aggregations