From 487ff458e662a703f302a700269d1dfa7a45dde4 Mon Sep 17 00:00:00 2001 From: Julien Viet Date: Wed, 19 Jul 2023 16:33:53 +0200 Subject: [PATCH] Update to executeBlocking API change --- .../io/vertx/grpc/BlockingServerInterceptor.java | 3 +-- .../src/main/java/io/vertx/grpc/VertxServer.java | 14 +++++--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/vertx-grpc/src/main/java/io/vertx/grpc/BlockingServerInterceptor.java b/vertx-grpc/src/main/java/io/vertx/grpc/BlockingServerInterceptor.java index b9c62283..d5659e59 100644 --- a/vertx-grpc/src/main/java/io/vertx/grpc/BlockingServerInterceptor.java +++ b/vertx-grpc/src/main/java/io/vertx/grpc/BlockingServerInterceptor.java @@ -47,8 +47,7 @@ private BlockingServerInterceptor(Vertx vertx, ServerInterceptor interceptor) { public ServerCall.Listener interceptCall(ServerCall serverCall, Metadata metadata, ServerCallHandler serverCallHandler) { AsyncListener asyncListener = new AsyncListener<>(); - vertx.>executeBlocking(blockingCode -> - blockingCode.complete(interceptor.interceptCall(serverCall, metadata, serverCallHandler)), + vertx.executeBlocking(() -> interceptor.interceptCall(serverCall, metadata, serverCallHandler), false).onComplete( ar -> { if (ar.succeeded()) { diff --git a/vertx-grpc/src/main/java/io/vertx/grpc/VertxServer.java b/vertx-grpc/src/main/java/io/vertx/grpc/VertxServer.java index 95b11a64..837a169c 100644 --- a/vertx-grpc/src/main/java/io/vertx/grpc/VertxServer.java +++ b/vertx-grpc/src/main/java/io/vertx/grpc/VertxServer.java @@ -115,13 +115,9 @@ void start(ContextInternal context, Handler> completionHandler group.addWorker(context.nettyEventLoop()); contextLocal.get().add(context); if (start) { - context.executeBlocking(v2 -> { - try { - server.start(); - v2.complete(); - } catch (IOException e) { - v2.fail(e); - } + context.executeBlocking(() -> { + server.start(); + return null; }).onComplete(completionHandler); } else { completionHandler.handle(Future.succeededFuture()); @@ -136,9 +132,9 @@ void stop(ContextInternal context, Promise promise) { contextLocal.get().remove(context); if (shutdown) { map.remove(id); - context.executeBlocking(p -> { + context.executeBlocking(() -> { server.shutdown(); - p.complete(); + return null; }).onComplete(promise); } else { promise.complete();