Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AsyncFailsafe#future(...) should completeExceptionally(...) not raise #84

Closed
brianm opened this issue Mar 3, 2017 · 4 comments
Closed

Comments

@brianm
Copy link

brianm commented Mar 3, 2017

If the circuit is open, I expect the CompletableFuture returned by AsyncFailsafe#future(...) to be already completed with the circuit open, rather than have the future method raise an exception.

A common case of CF oriented APIs is combing them for fan-out type behavior, particularly in the case where they are being used with a circuit breaker. In that case, the failure handling is usually baked into the CF graph, NOT in the construction of the CF graph.

@brianm brianm changed the title AsyncFailsafe#future(...) should completeExceptionally() not raise AsyncFailsafe#future(...) should completeExceptionally(...) not raise Mar 3, 2017
@jhalterman
Copy link
Member

jhalterman commented Mar 4, 2017

Hi Brian,

You are right - the current behavior is to immediately throw CircuitBreakerOpenException on any type of execution attempt, sync or async, if the configured breaker is open. Your point about this messing with the ability to chain CompletableFutures is valid though.

Just to make sure I understand your scenario and have it covered, do you mind sharing an example/test case?

jhalterman added a commit that referenced this issue Mar 30, 2017
…ny fallback handling) when CircuitBreakerOpenException occurs immediately upon invocation.

Fixes #84.
@jhalterman
Copy link
Member

@brianm Let me know if this change does or doesn't address your issue. See this test in particular.

@jhalterman
Copy link
Member

This has been released in 1.0.4.

@brianm
Copy link
Author

brianm commented Apr 2, 2017

Fabulous, thank you!

fzakaria pushed a commit to fzakaria/failsafe that referenced this issue Sep 28, 2017
…ny fallback handling) when CircuitBreakerOpenException occurs immediately upon invocation.

Fixes failsafe-lib#84.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants