log if close all channels took more than 1 seconds
authorVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Thu, 16 Jun 2016 11:59:03 +0000 (13:59 +0200)
committerVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Thu, 16 Jun 2016 13:24:52 +0000 (15:24 +0200)
platform/platform-impl/src/org/jetbrains/io/ChannelRegistrar.java

index e0698341d4dcb25f6ec0fc8863fc9ca9e007885e..8635b71598f2355edac1a72719054e0559cae07f 100644 (file)
@@ -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) {