Skip to content

Commit

Permalink
Again: Only check for thread isolation if the command had a chance to…
Browse files Browse the repository at this point in the history
… start executing
  • Loading branch information
MenschNestor committed Apr 27, 2018
1 parent 99e5893 commit 86eb945
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2440,6 +2440,7 @@ public void testSynchronousExecutionTimeoutValueViaExecute() {

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

final AtomicBoolean startedExecution = new AtomicBoolean();
HystrixObservableCommand<String> command = new HystrixObservableCommand<String>(properties) {
@Override
protected Observable<String> construct() {
Expand All @@ -2449,6 +2450,7 @@ protected Observable<String> construct() {
@Override
public void call(Subscriber<? super String> t1) {
try {
startedExecution.set(true);
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
Expand Down Expand Up @@ -2477,7 +2479,7 @@ protected Observable<String> resumeWithFallback() {
assertEquals("expected fallback value", "timed-out", value);

// Thread isolated
assertTrue(command.isExecutedInThread());
assertTrue(!startedExecution.get() || command.isExecutedInThread());
assertNotNull(command.getExecutionException());

assertEquals(0, command.metrics.getCurrentConcurrentExecutionCount());
Expand Down

0 comments on commit 86eb945

Please sign in to comment.