private static <V> V run( Callable<V> callable, TimedRetryAlgorithm timedAlgorithm, ResultRetryAlgorithm<V> resultAlgorithm) throws ExecutionException, InterruptedException { RetryAlgorithm<V> retryAlgorithm = new RetryAlgorithm<>(resultAlgorithm, timedAlgorithm); RetryingExecutor<V> executor = new DirectRetryingExecutor<>(retryAlgorithm); RetryingFuture<V> retryingFuture = executor.createFuture(callable); executor.submit(retryingFuture); return retryingFuture.get(); }
@Override protected RetryingExecutorWithContext<String> getExecutor(RetryAlgorithm<String> retryAlgorithm) { return new DirectRetryingExecutor<>(retryAlgorithm); }
private static <V> V run( Callable<V> callable, TimedRetryAlgorithm timedAlgorithm, ResultRetryAlgorithm<V> resultAlgorithm) throws ExecutionException, InterruptedException { RetryAlgorithm<V> retryAlgorithm = new RetryAlgorithm<>(resultAlgorithm, timedAlgorithm); RetryingExecutor<V> executor = new DirectRetryingExecutor<>(retryAlgorithm); RetryingFuture<V> retryingFuture = executor.createFuture(callable); executor.submit(retryingFuture); return retryingFuture.get(); }