guava-retrying
guava-retrying copied to clipboard
This is a small extension to Google's Guava library to allow for the creation of configurable retrying strategies for an arbitrary function call, such as something that talks to a remote service with...
I have use for a Retryer that retries methods that returns futures. If there is any interest I would be happy to work on contributing it back to this project....
Currently there is no way to retrieve last attempt number on success, only on error. It'd be nice to either be able to have a method on `Retryer` instance that...
**Usecase:** This is what I'd like to log: ``` Retrying yet another time because we failed last time... ``` What I could do is use a `RetryListener` and log as...
Consider ```WaitStrategies.fibonacciWait(3, TimeUnit.MINUTES)``` with ```StopStrategies.stopAfterAttempt(5)```. I would expect this to run with delays of something like 1 minute, 1 minutes, 2 minutes, 3 minutes. In fact, it runs with 1ms,...
This adds a variant of the exponential wait strategy that waits for a random time between the minimum provided time and an exponentially increasing maximum time (under a maximum provided...
Is there a way to initialize the wait strategy to be a fixed amount of time? As in, all successive exponential wait times are added onto a fixed wait time....
public static void main(String[] args) { Retryer retryer = RetryerBuilder.newBuilder() .retryIfException() .retryIfResult(aBoolean -> Objects.equals(aBoolean, false)) .withWaitStrategy(WaitStrategies.fixedWait(1, TimeUnit.SECONDS)) .withStopStrategy(StopStrategies.stopAfterAttempt(20)) .withRetryListener(new RetryLogListener()) .withAttemptTimeLimiter(AttemptTimeLimiters.fixedTimeLimit(5, TimeUnit.SECONDS)) .build(); Callable callable = buildCallable(3, 10); Boolean result...
fixed minor syntax for readme headers.