From 9cac494190d958f132724bc53cc8ee16f8e94d03 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 16 Jun 2016 13:59:03 +0200 Subject: [PATCH] log if close all channels took more than 1 seconds --- .../src/org/jetbrains/io/ChannelRegistrar.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/platform-impl/src/org/jetbrains/io/ChannelRegistrar.java b/platform/platform-impl/src/org/jetbrains/io/ChannelRegistrar.java index e0698341d4dc..8635b71598f2 100644 --- a/platform/platform-impl/src/org/jetbrains/io/ChannelRegistrar.java +++ b/platform/platform-impl/src/org/jetbrains/io/ChannelRegistrar.java @@ -71,6 +71,7 @@ public final class ChannelRegistrar extends ChannelInboundHandlerAdapter { Future result; try { + long start = System.currentTimeMillis(); Object[] channels = openChannels.toArray(new Channel[]{}); ChannelGroupFuture groupFuture = openChannels.close(); // server channels are closed in first turn, so, small timeout is relatively ok @@ -78,6 +79,11 @@ public final class ChannelRegistrar extends ChannelInboundHandlerAdapter { LOG.warn("Cannot close all channels for 10 seconds, channels: " + Arrays.toString(channels)); } result = groupFuture; + + long duration = System.currentTimeMillis() - start; + if (duration > 1000) { + LOG.info("Close all channels took " + duration + " ms: " + (duration / 60000) + " min " + ((duration % 60000) / 1000) + "sec"); + } } finally { if (eventLoopGroup != null) { -- 2.32.0