Skip to content

Commit

Permalink
Removed checks that ThreadContext.withContextPropagation(CS/CF) canno…
Browse files Browse the repository at this point in the history
…t run async actions without executor

Because it really depends if there is a default executor, and we have tests for both cases elsewhere (with/without)
  • Loading branch information
FroMage committed Aug 25, 2020
1 parent 710aab7 commit dcdeb54
Showing 1 changed file with 0 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -946,14 +946,6 @@ public void withContextCaptureDependentCompletableFuturesRunWithContext()
// guarantees about context propagation
CompletableFuture<Integer> unmanagedStage5 = unmanagedStage1.thenApply(i -> i / 2);

try {
CompletableFuture<Integer> stage6 = stage4.thenApplyAsync(i -> i / 5);
Assert.fail("Should not be able to create async completion stage because withContextCapture provides no executor. " + stage6);
}
catch (UnsupportedOperationException x) {
// test passes, CompletableFutures from withContextCapture are not backed by an executor
}

Label.set("withContextCapture-CompletableFuture-test-label-E");

unmanagedStage1.complete(1010);
Expand Down Expand Up @@ -1065,14 +1057,6 @@ public void withContextCaptureDependentCompletionStagesRunWithContext() throws E
return i - 2345;
}, labelContextExecutor); // supplied executor runs the action, but does not determine context propagation

try {
CompletionStage<Void> stage5 = stage4.thenAcceptAsync(i -> System.out.println("This should not ever run."));
Assert.fail("Should not be able to create async completion stage because withContextCapture provides no executor. " + stage5);
}
catch (UnsupportedOperationException x) {
// test passes, CompletableFutures from withContextCapture are not backed by an executor
}

Buffer.set(new StringBuffer("withContextCapture-CompletionStage-test-buffer-E"));

unmanagedStage1.complete(1234);
Expand Down

0 comments on commit dcdeb54

Please sign in to comment.