21 questions
0
votes
0
answers
60
views
net.jodah.failsafe.SyncFailsafe replacement in 2.4.4
I'm trying to update net.jodah.failsafe from 1.0.4 to 2.4.4. I have code that uses SyncFailSafe and BiPredicate classes, which don't seem to be available anymore in 2.4.4. What would be the ...
0
votes
1
answer
186
views
Is it possible to have multiple Fallback policies using Failsafe library?
Using Failsafe library, I want to to be able to use multiple endpoints as backups whenever the primary endpoint fails. I tried the setup below, but it only executes the final fallback policy.
I couldn'...
2
votes
1
answer
701
views
How to use circuit breaker based on a method parameter?
I have a http client that connects to the same api endpoint on different servers. Which server it connects to, depends on business logic.
Let's say the http client method is connect(url). How can I ...
0
votes
0
answers
194
views
How to make the generic FailsafeExecutor reusable
I am using the FailSafe library to handle failures and retries.
The current implementation creates the generic FailsafeExecutor on each run -
var result = Failsafe.with(Collections.singletonList(...
0
votes
1
answer
156
views
Using custom Java annotation in pom.xml with failsave
I created a custom Java annotation
@Tag("webservice")
public @interface WebserviceTest {
boolean executeAndIgnoreCondition() default false;
}
Furthermore I created Java test with this ...
3
votes
0
answers
990
views
Writing Unit Test for Failsafe Retry and Timeout policy
Using Failsafe by jhalterman for the first time ( GIT, Website ) to add a simple asynchronous module to send sms. I am using only Retry and Timeout policy and implementation is working fine
Failsafe....
0
votes
1
answer
420
views
Failsafe undesirably negating DataBufferException
I am currently creating a retry mechanism for performing requests using the failsafe-lib.
The issue: the RetryPolicy that I defined includes several timeout-related exceptions, but when I use the ...
0
votes
0
answers
213
views
Failsafe: is it possible to execute Function<T, R> with it?
I'm working with net.jodah.failsafe framework.
From what I found in tutorials, Failsafe can execute Runnable and Supplier.
Is there any API to execute Function? I need it because method, that I want ...
0
votes
0
answers
975
views
Failsafe : Execute a void method and return result based on success/failure
I am using Failsafe framework (link) to execute a method. My use case is to execute a void method x number of times and return success or failure based on the execution result. Below is how my (pseudo)...
3
votes
1
answer
1k
views
Why CopyOnWriteArrayList needs copies for both write and read operations?
Coming from this article, it says:
When we are
using any of the modify methods – such as add() or remove() – the
whole content of the CopyOnWriteArrayList is copied into the new
internal copy.
Due to ...
0
votes
1
answer
2k
views
Apache HttpClient : Retry with failsafe results in 400 (bad request)
I am using Apache HttpClient with Failsafe java library. Below is how the (pseudo) code looks like:
RetryPolicy<CloseableHttpResponse> policy = new RetryPolicy<>()
....
2
votes
1
answer
346
views
java.util.ConcurrentModificationException while mutating an object
I am iterating over a List of CustomObject and while doing this iteration, I am mutating this object by adding a tag to tags list of this custom object. I am not adding or removing any CustomObject to ...
3
votes
1
answer
747
views
How does ConcurrentSkipListSet has Iterators that are weakly consistent? Understanding meaning of 'weakly consistent'
Fail-fast iterator iterates over collection. If collection gets modified while iterating, we get exception. Opposite applies for fail-safe, where iteration is happening on one collection, while write ...
1
vote
1
answer
2k
views
Jodah Failsafe Library Timeout is taking longer then expected
I have a situation in which I wanted to implement an API retry mechanism.
Let say I have an API that calls third party API where normal response time comes under 2 seconds but sometimes we got an ...
4
votes
1
answer
63
views
Why I'm not getting ConcurrentModificationException while removing element from ArrayList during iteration [duplicate]
I am using the following code to loop through an arraylist and then removing one element from the arraylist.
Here i'm expecting ConcurrentModificationException. But didn't get that exception. ...
1
vote
1
answer
1k
views
mechanism of "run" method of failsafe
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)...
0
votes
1
answer
3k
views
Failsafe RetryPolicy - throw exception from supplyAsync
I'm implementing a retry policy. Basically what I want to do is retry a POST request on a separate thread. I'm using Failsafe (https://failsafe.dev/async-execution/#async-integration) Here is my code
...
1
vote
2
answers
9k
views
Failsafe with RetryPolicy and CircuitBreaker throws CircuitBreakerOpenException
I am trying to combine a retry policy with the CircuitBreaker pattern with Failsafe but I get a CircuitBreakerOpenException exception when an attempt is made with the circuit open and it is ...
4
votes
1
answer
3k
views
How to write a unit test for a method that does a retry with back off? (Using FailSafe in Java)
This is the method that I would like to test:
void someMethodThatRetries(){
Failsafe.with( retryPolicy ).get(() -> callServiceX());
}
Retry policy looks like this :
this.retryPolicy = new ...
0
votes
1
answer
3k
views
Failsafe - do some action when retries exceeded and try one more time
I have a use case, where I need to call UPDATE/DELETE Rest endpoint, which might return exception about entity being locked for editing.
I want to wait some time for entity being unlocked, otherwise ...
13
votes
4
answers
3k
views
How to implement retry policies while sending data to another application?
I am working on my application which sends data to zeromq. Below is what my application does:
I have a class SendToZeroMQ that send data to zeromq.
Add same data to retryQueue in the same class so ...