Skip to content

Commit

Permalink
Assure that exception in async interceptor doesn't prevent completion
Browse files Browse the repository at this point in the history
Signed-off-by: Patrik Dudits <[email protected]>
  • Loading branch information
pdudits authored and jansupol committed Oct 17, 2019
1 parent d92935a commit 7b3a86b
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,15 @@ private CompletableFuture asynchronousCall(Invocation.Builder builder,
result.completeExceptionally(e);
}
}).exceptionally(throwable -> {
asyncInterceptors.forEach(AsyncInvocationInterceptor::removeContext);
// Since it could have been the removeContext method causing exception, we need to be more careful
// to assure, that the future completes
asyncInterceptors.forEach(interceptor -> {
try {
interceptor.removeContext();
} catch (Throwable e) {
throwable.addSuppressed(e);
}
});
result.completeExceptionally(throwable);
return null;
});
Expand Down

0 comments on commit 7b3a86b

Please sign in to comment.