@Override public final <U> CompletionStage<U> thenComposeAsync(Function<? super T, ? extends CompletionStage<U>> fn, Executor executor) { return of(delegate.thenComposeAsync(fn, executor), provider); }
@Override public final CompletionStage<Void> thenAccept(Consumer<? super T> action) { return of(delegate.thenAccept(action), provider); }
@Override public final CompletionStage<Void> thenRun(Runnable action) { return of(delegate.thenRun(action), provider); }
@Override public final <U, V> CompletionStage<V> thenCombine(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) { return of(delegate.thenCombine(other, fn), provider); }
@Override public final CompletionStage<Void> runAfterBoth(CompletionStage<?> other, Runnable action) { return of(delegate.runAfterBoth(other, action), provider); }
@Override public final <U> CompletionStage<U> applyToEither(CompletionStage<? extends T> other, Function<? super T, U> fn) { return of(delegate.applyToEither(other, fn), provider); }
@Override public final CompletionStage<Integer> executeAsync(Executor executor) { return ExecutorProviderCompletionStage.of(CompletableFuture.supplyAsync(blocking(this::execute), executor), () -> executor); }
@Override public final <U, V> CompletionStage<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn, Executor executor) { return of(delegate.thenCombineAsync(other, fn, executor), provider); }
@Override public final <U> CompletionStage<Void> thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) { return of(delegate.thenAcceptBoth(other, action), provider); }
@Override public final CompletionStage<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor) { return of(delegate.runAfterBothAsync(other, action, executor), provider); }
@Override public final CompletionStage<Void> runAfterEither(CompletionStage<?> other, Runnable action) { return of(delegate.runAfterEither(other, action), provider); }
@Override public final CompletionStage<T> whenComplete(BiConsumer<? super T, ? super Throwable> action) { return of(delegate.whenComplete(action), provider); }
@Override public final CompletionStage<Result<R>> fetchAsync(Executor executor) { return ExecutorProviderCompletionStage.of(CompletableFuture.supplyAsync(blocking(this::fetch), executor), () -> executor); }
@Override public CompletionStage<Result<Record>> fetchAsync(Executor executor, ResultSet rs, DataType<?>... types) { return ExecutorProviderCompletionStage.of( CompletableFuture.supplyAsync(blocking(() -> fetch(rs, types)), executor), () -> executor ); }
@Override public CompletionStage<Result<Record>> fetchAsync(Executor executor, ResultSet rs, Class<?>... types) { return ExecutorProviderCompletionStage.of( CompletableFuture.supplyAsync(blocking(() -> fetch(rs, types)), executor), () -> executor ); }
@Override public CompletionStage<Result<Record>> fetchAsync(Executor executor, ResultSet rs) { return ExecutorProviderCompletionStage.of( CompletableFuture.supplyAsync(blocking(() -> fetch(rs)), executor), () -> executor ); }
@Override public final <U, V> CompletionStage<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) { return of(delegate.thenCombineAsync(other, fn, provider.provide()), provider); }
@Override public final CompletionStage<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action) { return of(delegate.runAfterEitherAsync(other, action, provider.provide()), provider); }
@Override public <T> CompletionStage<T> transactionResultAsync(Executor executor, TransactionalCallable<T> transactional) { if (configuration().transactionProvider() instanceof ThreadLocalTransactionProvider) throw new ConfigurationException("Cannot use TransactionalCallable with ThreadLocalTransactionProvider"); return ExecutorProviderCompletionStage.of(CompletableFuture.supplyAsync( () -> transactionResult(transactional), executor), () -> executor ); }
@Override public CompletionStage<Void> transactionAsync(Executor executor, TransactionalRunnable transactional) { if (configuration().transactionProvider() instanceof ThreadLocalTransactionProvider) throw new ConfigurationException("Cannot use TransactionalRunnable with ThreadLocalTransactionProvider"); return ExecutorProviderCompletionStage.of(CompletableFuture.supplyAsync( () -> { transaction(transactional); return null; }, executor), () -> executor ); }