Clarify @Asynchronous @Retry @Bulkhead
See original GitHub issueWhen using the thread pool approach, when a request cannot be added to the waiting queue, BulkheadException will be thrown.
However, if @Retry
is also used, it might not be possible to throw the BulkheadException
immediately. E.g. in the following example, if the first invocation fails due to some networking problem and the second invocation fails due to bulkhead, we cannot throw the BulkheadException
when ping()
completes from the client point of view. The only thing we can do is to “throw” the BulkheadException
via Future.get()
and ExecutionException
.
@Asynchronous
@Bulkhead(value = 5)
@Retry(maxRetry = 4)
public Future<String> ping() {
// do some networking...
return CompletableFuture.completedFuture("ok");
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (14 by maintainers)
Top Results From Across the Web
Microprofile Fault Tolerance
This specification defines the annotations: @Asynchronous , @Bulkhead , @CircuitBreaker , @Fallback , @Retry and @Timeout . Each annotation ...
Read more >c# - Clarification on running multiple async tasks in parallel ...
I'm trying to run multiple async Tasks in parallel with throttling using polly AsyncBulkheadPolicy. My understanding so far is that the policy ...
Read more >Resilience design patterns: retry, fallback, timeout, circuit ...
In this blog post we want to take a look at four patterns from the latency control category: Retry, fallback, timeout, and circuit...
Read more >Microprofile Fault Tolerance
@Asynchronous, @Bulkhead, @CircuitBreaker, @Fallback, @Retry and @Timeout are all interceptor bindings. These annotations may be bound at the class level or ...
Read more >MicroProfile Fault Tolerance Annotations - Tomitribe
Bulkhead – isolate failures in part of the system. · Circuit breaker – offer a way to fail fast. · Retry – define...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As for today’s hangout, the current proposal is:
If @Bulkhead used with @Async and @Retry, when BulkheadException occurs, which will trigger the Retry, the execution of Retry will happen on the calling thread.
I agree with @mkouba - asynchronous methods should return asynchronous result and also throw exceptions asynchronously. An exception is an alternative return type and should behave as the normal return type unless there are specific needs to throw them directly.
The spec now says:
I would change this to “Method invocation and all the 4 FT interceptors will occur in a different thread”.
That would imply that
@Bulkhead
also happens on another thread and hence doesn’t throw an exception but finish the future with an exception.This would make even more sense when we add
CompletionStage
support, where an exception handler would be called in a separate thread.