Comments (7)
Doesn't FailsafeExecutor::run(ContextualRunnable<Void>)
give you that already?
Failsafe.with(...)
.run(ctx -> {
int count = ctx.getExecutionCount();
... do stuff with count, maybe throw checked exception ...
});
As far as I know, the ExecutionEvent
types just offer subsets of ExecutionContext
information.
from failsafe.
Oh, yes, you are right, I overlooked that method. Thank you!
from failsafe.
But one question, I cannot obtain the duration for the next attempt? I wanted to log that it will wait now for that duration until retrying again.
from failsafe.
You can configure an OnRetryScheduled event listener on the retry policy, and use event.getDelay()
. See:
https://failsafe.dev/retry/#event-listeners
https://failsafe.dev/javadoc/core/dev/failsafe/RetryPolicyBuilder.html#onRetryScheduled-dev.failsafe.event.EventListener-
from failsafe.
Thank you. I cannot do exactly what I wanted in an elegant way because the information is not available in the run(...) block, but nevermind.
from failsafe.
There's no way, elegant or otherwise, to supply the delay before the next execution attempt within the current attempt, because you don't in general know whether the current attempt will be seen as a failure or, if a delay function is used, what delay will be computed. (The delay function can use the result of the failed attempt to determine the delay.)
from failsafe.
Okay, I see.
from failsafe.
Related Issues (20)
- DelegatingScheduler singletons in modern style HOT 9
- FailsafeCall micro refactoring, plus World-Wide Nr.1 duplicated utility method for OkHttp HOT 4
- Feature: micrometer.io metrics integration HOT 3
- FYI: Very compact "lean" version of DelegatingScheduler HOT 1
- handleresultif and fallback with exception -- possible? HOT 6
- where is the logging? HOT 2
- Add FailsafeExecutionException extending FailsafeException for wrapping Throwables in sync get HOT 1
- Make CircuitBreaker delay time mockable for testing HOT 6
- Support Java Modules HOT 1
- Add Failsafe to vertx-awesome HOT 1
- Result futures strongly retain supplying functions
- Why does CheckedPredicate exist? HOT 2
- Also add note about default maxRetries of 3 to maxDuration section of the documentation HOT 7
- Bulkhead policy may drop requests when maxWaitTime is specified HOT 8
- Guidance around CheckedPredicate HOT 2
- Time based error limiter policy
- [Question]Can withBackoff and withDelay be used at the same time? HOT 2
- RetryPolicy handleIf not working with DynamoDbException in predicate HOT 4
- dev.failsafe.Functions.* do not propagate toString to the wrapped object
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from failsafe.