@Test public void executeBlockingThrowingExceptionShouldCompleteWithException() throws InterruptedException { CountDownLatch countDownLatch = new CountDownLatch(1); CompletableFuture<?> future = queryExecutor.executeBlocking(f -> { throw new RuntimeException(); }); future.whenComplete((v, ex) -> { Assert.assertEquals(RuntimeException.class, ex.getClass()); countDownLatch.countDown(); }); Assert.assertTrue(countDownLatch.await(1, TimeUnit.SECONDS)); }
<U> CompletableFuture<U> executeBlocking(Handler<Promise<U>> blockingCodeHandler){ VertxCompletableFuture<U> future = new VertxCompletableFuture<>(vertx); vertx.executeBlocking(blockingCodeHandler, false, createCompletionHandler(future)); return future; }
JDBCCompletableFutureGenericQueryExecutor extends AbstractQueryExecutor implements JDBCQueryExecutor<CompletableFuture<?>>, CompletableFutureQueryExecutor { <U> CompletableFuture<U> executeBlocking(Handler<Promise<U>> blockingCodeHandler){ VertxCompletableFuture<U> future = new VertxCompletableFuture<>(vertx); vertx.executeBlocking(blockingCodeHandler, false, createCompletionHandler(future)); return future; } }
JDBCCompletableFutureGenericQueryExecutor extends AbstractQueryExecutor implements JDBCQueryExecutor<CompletableFuture<?>>, CompletableFutureQueryExecutor { <U> CompletableFuture<U> executeBlocking(Handler<Promise<U>> blockingCodeHandler){ VertxCompletableFuture<U> future = new VertxCompletableFuture<>(vertx); vertx.executeBlocking(blockingCodeHandler, false, createCompletionHandler(future)); return future; } JDBCCompletableFutureGenericQueryExecutor(Configuration configuration, Vertx vertx); }
JDBCCompletableFutureGenericQueryExecutor extends AbstractQueryExecutor implements JDBCQueryExecutor<CompletableFuture<?>>, CompletableFutureQueryExecutor { <U> CompletableFuture<U> executeBlocking(Handler<Promise<U>> blockingCodeHandler){ VertxCompletableFuture<U> future = new VertxCompletableFuture<>(vertx); vertx.executeBlocking(blockingCodeHandler, false, createCompletionHandler(future)); return future; } JDBCCompletableFutureGenericQueryExecutor(Configuration configuration, Vertx vertx); @Override CompletableFuture<U> executeAny(Function<DSLContext, U> function); @Override CompletableFuture<Integer> execute(Function<DSLContext, ? extends Query> queryFunction); @Override CompletableFuture<QueryResult> query(Function<DSLContext, ? extends ResultQuery<R>> queryFunction); }
JDBCCompletableFutureGenericQueryExecutor extends AbstractQueryExecutor implements JDBCQueryExecutor<CompletableFuture<?>>, CompletableFutureQueryExecutor { <U> CompletableFuture<U> executeBlocking(Handler<Promise<U>> blockingCodeHandler){ VertxCompletableFuture<U> future = new VertxCompletableFuture<>(vertx); vertx.executeBlocking(blockingCodeHandler, false, createCompletionHandler(future)); return future; } JDBCCompletableFutureGenericQueryExecutor(Configuration configuration, Vertx vertx); @Override CompletableFuture<U> executeAny(Function<DSLContext, U> function); @Override CompletableFuture<Integer> execute(Function<DSLContext, ? extends Query> queryFunction); @Override CompletableFuture<QueryResult> query(Function<DSLContext, ? extends ResultQuery<R>> queryFunction);  }