/** * Executes the {@code supplier} asynchronously until a successful result is returned or the configured policies are * exceeded. This method is intended for integration with asynchronous code. Retries must be manually scheduled via * one of the {@code AsyncExecution.retry} methods. * <p> * If a configured circuit breaker is open, the resulting future is completed with {@link * CircuitBreakerOpenException}. * * @throws NullPointerException if the {@code supplier} is null * @throws RejectedExecutionException if the {@code supplier} cannot be scheduled for execution */ public <T extends R> CompletableFuture<T> getAsyncExecution(AsyncSupplier<T> supplier) { return callAsync(execution -> Functions.asyncOfExecution(supplier, execution), true); }
/** * Executes the {@code runnable} asynchronously until successful or until the configured policies are exceeded. This * method is intended for integration with asynchronous code. Retries must be manually scheduled via one of the {@code * AsyncExecution.retry} methods. * <p> * If a configured circuit breaker is open, the resulting future is completed with {@link * CircuitBreakerOpenException}. * * @throws NullPointerException if the {@code runnable} is null * @throws RejectedExecutionException if the {@code runnable} cannot be scheduled for execution */ public CompletableFuture<Void> runAsyncExecution(AsyncRunnable runnable) { return callAsync(execution -> Functions.asyncOfExecution(runnable, execution), true); }