Using Failsafe (which I authored):
RetryPolicy retryPolicy = new RetryPolicy() .retryOn(ExecutionException.class) .withMaxRetries(3);Failsafe.with(retryPolicy) .onRetry(r -> LOG.debug("retrying...")) .withFallback(e -> LOG.debug("do something else...")) .run(() -> someCode());
It's about as simple and expressive as you can get for your use case.