question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clarify @Asynchronous @Retry @Bulkhead

See original GitHub issue

When 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:closed
  • Created 5 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
Emily-Jiangcommented, May 2, 2018

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.

1reaction
OndroMihcommented, May 2, 2018

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:

The @Asynchronous annotation can be used together with @Timeout, @Fallback, @Bulkhead and @Retry. Method invocation will occur in a different thread.

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found