From 7da32d19f9623ca98c8a4ba76e7c406bf9318d4d Mon Sep 17 00:00:00 2001 From: kkloudas Date: Wed, 22 Nov 2017 18:25:06 +0100 Subject: [PATCH] [FLINK-8049] [rest] REST client reports netty exceptions on shutdown. This closes #5057. --- .../java/org/apache/flink/runtime/rest/RestClient.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/RestClient.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/RestClient.java index cd80083aedbba..71891de9bf3b5 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/RestClient.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/RestClient.java @@ -122,8 +122,14 @@ public void shutdown(Time timeout) { CompletableFuture groupFuture = new CompletableFuture<>(); if (bootstrap != null) { if (bootstrap.group() != null) { - bootstrap.group().shutdownGracefully(0, timeout.toMilliseconds(), TimeUnit.MILLISECONDS) - .addListener(ignored -> groupFuture.complete(null)); + bootstrap.group().shutdownGracefully(0L, timeout.toMilliseconds(), TimeUnit.MILLISECONDS) + .addListener(finished -> { + if (finished.isSuccess()) { + groupFuture.complete(null); + } else { + groupFuture.completeExceptionally(finished.cause()); + } + }); } }