Skip to content

Commit 86eb945

Browse files
committed
Again: Only check for thread isolation if the command had a chance to start executing
1 parent 99e5893 commit 86eb945

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

hystrix-core/src/test/java/com/netflix/hystrix/HystrixObservableCommandTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2440,6 +2440,7 @@ public void testSynchronousExecutionTimeoutValueViaExecute() {
24402440

24412441
System.out.println(">>>>> Begin: " + System.currentTimeMillis());
24422442

2443+
final AtomicBoolean startedExecution = new AtomicBoolean();
24432444
HystrixObservableCommand<String> command = new HystrixObservableCommand<String>(properties) {
24442445
@Override
24452446
protected Observable<String> construct() {
@@ -2449,6 +2450,7 @@ protected Observable<String> construct() {
24492450
@Override
24502451
public void call(Subscriber<? super String> t1) {
24512452
try {
2453+
startedExecution.set(true);
24522454
Thread.sleep(2000);
24532455
} catch (InterruptedException e) {
24542456
e.printStackTrace();
@@ -2477,7 +2479,7 @@ protected Observable<String> resumeWithFallback() {
24772479
assertEquals("expected fallback value", "timed-out", value);
24782480

24792481
// Thread isolated
2480-
assertTrue(command.isExecutedInThread());
2482+
assertTrue(!startedExecution.get() || command.isExecutedInThread());
24812483
assertNotNull(command.getExecutionException());
24822484

24832485
assertEquals(0, command.metrics.getCurrentConcurrentExecutionCount());

0 commit comments

Comments
 (0)