From f80bca252468ca99c6d2f47ff7b1d0fdd07affb3 Mon Sep 17 00:00:00 2001 From: gurudevtest Date: Thu, 1 Jul 2021 12:11:18 -0700 Subject: [PATCH 1/2] Update ClientConnectionsShutdown.java --- .../server/ClientConnectionsShutdown.java | 43 ------------------- 1 file changed, 43 deletions(-) diff --git a/zuul-core/src/main/java/com/netflix/zuul/netty/server/ClientConnectionsShutdown.java b/zuul-core/src/main/java/com/netflix/zuul/netty/server/ClientConnectionsShutdown.java index 9303f7a8..a531bbc5 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/netty/server/ClientConnectionsShutdown.java +++ b/zuul-core/src/main/java/com/netflix/zuul/netty/server/ClientConnectionsShutdown.java @@ -109,48 +109,5 @@ private void initDiscoveryListener() public void gracefullyShutdownClientChannels() { LOG.warn("Gracefully shutting down all client channels"); - try { - - - // Mark all active connections to be closed after next response sent. - LOG.warn("Flagging CLOSE_AFTER_RESPONSE on " + channels.size() + " client channels."); - // Pick some arbitrary executor. - PromiseCombiner closeAfterPromises = new PromiseCombiner(ImmediateEventExecutor.INSTANCE); - for (Channel channel : channels) - { - ConnectionCloseType.setForChannel(channel, ConnectionCloseType.DELAYED_GRACEFUL); - - ChannelPromise closePromise = channel.pipeline().newPromise(); - channel.attr(ConnectionCloseChannelAttributes.CLOSE_AFTER_RESPONSE).set(closePromise); - // TODO(carl-mastrangelo): remove closePromise, since I don't think it's needed. Need to verify. - closeAfterPromises.add(channel.closeFuture()); - } - - // Wait for all of the attempts to close connections gracefully, or max of 30 secs each. - Promise combinedCloseAfterPromise = executor.newPromise(); - closeAfterPromises.finish(combinedCloseAfterPromise); - combinedCloseAfterPromise.await(30, TimeUnit.SECONDS); - - // Close all of the remaining active connections. - LOG.warn("Closing remaining active client channels."); - List forceCloseFutures = new ArrayList<>(); - channels.forEach(channel -> { - if (channel.isActive()) { - ChannelFuture f = channel.pipeline().close(); - forceCloseFutures.add(f); - } - }); - - LOG.warn("Waiting for " + forceCloseFutures.size() + " client channels to be closed."); - PromiseCombiner closePromisesCombiner = new PromiseCombiner(ImmediateEventExecutor.INSTANCE); - closePromisesCombiner.addAll(forceCloseFutures.toArray(new ChannelFuture[0])); - Promise combinedClosePromise = executor.newPromise(); - closePromisesCombiner.finish(combinedClosePromise); - combinedClosePromise.await(5, TimeUnit.SECONDS); - LOG.warn(forceCloseFutures.size() + " client channels closed."); - } - catch (InterruptedException ie) { - LOG.warn("Interrupted while shutting down client channels"); - } } } From 7550b00025b499d29f2f76f76d2ed23814b3d110 Mon Sep 17 00:00:00 2001 From: gurudevtest Date: Thu, 1 Jul 2021 12:20:01 -0700 Subject: [PATCH 2/2] Update ClientConnectionsShutdown.java --- .../com/netflix/zuul/netty/server/ClientConnectionsShutdown.java | 1 + 1 file changed, 1 insertion(+) diff --git a/zuul-core/src/main/java/com/netflix/zuul/netty/server/ClientConnectionsShutdown.java b/zuul-core/src/main/java/com/netflix/zuul/netty/server/ClientConnectionsShutdown.java index a531bbc5..f4a2ad48 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/netty/server/ClientConnectionsShutdown.java +++ b/zuul-core/src/main/java/com/netflix/zuul/netty/server/ClientConnectionsShutdown.java @@ -109,5 +109,6 @@ private void initDiscoveryListener() public void gracefullyShutdownClientChannels() { LOG.warn("Gracefully shutting down all client channels"); + //rev1 } }