/** * Retry the given operation the given number of times in case of a failure. * * @param operation to executed * @param retries if the operation failed * @param executor to use to run the futures * @param <T> type of the result * @return Future containing either the result of the operation or a {@link RetryException} */ public static <T> CompletableFuture<T> retry( final Supplier<CompletableFuture<T>> operation, final int retries, final Executor executor) { final CompletableFuture<T> resultFuture = new CompletableFuture<>(); retryOperation(resultFuture, operation, retries, executor); return resultFuture; }
/** * Retry the given operation the given number of times in case of a failure. * * @param operation to executed * @param retries if the operation failed * @param executor to use to run the futures * @param <T> type of the result * @return Future containing either the result of the operation or a {@link RetryException} */ public static <T> CompletableFuture<T> retry( final Supplier<CompletableFuture<T>> operation, final int retries, final Executor executor) { final CompletableFuture<T> resultFuture = new CompletableFuture<>(); retryOperation(resultFuture, operation, retries, executor); return resultFuture; }
/** * Retry the given operation the given number of times in case of a failure. * * @param operation to executed * @param retries if the operation failed * @param executor to use to run the futures * @param <T> type of the result * @return Future containing either the result of the operation or a {@link RetryException} */ public static <T> CompletableFuture<T> retry( final Supplier<CompletableFuture<T>> operation, final int retries, final Executor executor) { final CompletableFuture<T> resultFuture = new CompletableFuture<>(); retryOperation(resultFuture, operation, retries, executor); return resultFuture; }
} else { if (retries > 0) { retryOperation( resultFuture, operation,
} else { if (retries > 0) { retryOperation( resultFuture, operation,
} else { if (retries > 0) { retryOperation( resultFuture, operation,