I am using Failsafe
(https://github.com/jhalterman/failsafe) as my retry logic framework and want to know more of how "run" method of failsafe works.
Suppose I have:
void MyCurrentFunction(parameter) {
Failsafe.with(MY_RETRY_POLICY)
.run(() -> runJob(parameter));
OtherFunction1();
}
Then when MyCurrentFunction
runs, will Failsafe.run
blocks execution of MyCurrentFunction? In other words, will OtherFunction1
be executed before all retries finishes?
Here is code that checks your question (Note: the code is related Failsafe 2.0)
The answer is No;
OtherFunction1
will not be executed before all retries finishes.Actually, if all retries fail
OtherFunction1
will never be invoked.Here is the output for test code
Still, you can modify the retry policy to execute
OtherFunction1
1) After each retry
2) After retries fail