rhuffman / re-retrying

A Java library to allow for the creation of configurable retrying strategies for an arbitrary function call, such as something that communicates with a remote service with flaky uptime.
Apache License 2.0
35 stars 6 forks source link

Handle Runnables in addition to Callables #26

Closed rhuffman closed 6 years ago

rhuffman commented 6 years ago

Added new method to Retryer:

public void run(Runnable runnable) throws RetryException, InterruptedException

Changed the call method to throw RetryException and InterruptedException instead of Exception.

There was a lot of work on this branch attempting to have call and run methods that did not throw checked exceptions. But in the end most of those changes were rejected. InterruptedExceptions have to be dealt with, and were dealt with poorly in the original library. Now InterruptedExceptions from the BlockingStrategy are simply propagated rather than hoping the caller knows enough to check the interrupted state on the thread. And since InterruptedExceptions have to be propagated, there is no way to have a call or run method that does not at least throws that checked exception.

This PR also includes an update to JUnit 5. Currently only the RetryerTest uses the Jupiter API: all other tests are still written in JUnit 4.