@Test public void shutdownWithoutStartTest() throws InstantiationException, IOException { NioServer nioServer = getNettyServer(null); nioServer.shutdown(); }
@Override public void shutdown() { logger.info("Shutting down NettyServer"); if (bossGroup != null && workerGroup != null && (!bossGroup.isTerminated() || !workerGroup.isTerminated())) { long shutdownBeginTime = System.currentTimeMillis(); workerGroup.shutdownGracefully(); bossGroup.shutdownGracefully(); try { if (!(workerGroup.awaitTermination(30, TimeUnit.SECONDS) && bossGroup.awaitTermination(30, TimeUnit.SECONDS))) { logger.error("NettyServer shutdown failed after waiting for 30 seconds"); nettyMetrics.nettyServerShutdownError.inc(); } } catch (InterruptedException e) { logger.error("NettyServer termination await was interrupted. Shutdown may have been unsuccessful", e); nettyMetrics.nettyServerShutdownError.inc(); } finally { long shutdownTime = System.currentTimeMillis() - shutdownBeginTime; logger.info("NettyServer shutdown took {} ms", shutdownTime); nettyMetrics.nettyServerShutdownTimeInMs.update(shutdownTime); } } }
NettyServer implements NioServer { @Override public void shutdown() { logger.info("Shutting down NettyServer"); if (bossGroup != null && workerGroup != null && (!bossGroup.isTerminated() || !workerGroup.isTerminated())) { long shutdownBeginTime = System.currentTimeMillis(); workerGroup.shutdownGracefully(); bossGroup.shutdownGracefully(); try { if (!(workerGroup.awaitTermination(30, TimeUnit.SECONDS) && bossGroup.awaitTermination(30, TimeUnit.SECONDS))) { logger.error("NettyServer shutdown failed after waiting for 30 seconds"); nettyMetrics.nettyServerShutdownError.inc(); } } catch (InterruptedException e) { logger.error("NettyServer termination await was interrupted. Shutdown may have been unsuccessful", e); nettyMetrics.nettyServerShutdownError.inc(); } finally { long shutdownTime = System.currentTimeMillis() - shutdownBeginTime; logger.info("NettyServer shutdown took {} ms", shutdownTime); nettyMetrics.nettyServerShutdownTimeInMs.update(shutdownTime); } } } }
NettyServer implements NioServer { @Override public void shutdown() { logger.info("Shutting down NettyServer"); if (bossGroup != null && workerGroup != null && (!bossGroup.isTerminated() || !workerGroup.isTerminated())) { long shutdownBeginTime = System.currentTimeMillis(); workerGroup.shutdownGracefully(); bossGroup.shutdownGracefully(); try { if (!(workerGroup.awaitTermination(30, TimeUnit.SECONDS) && bossGroup.awaitTermination(30, TimeUnit.SECONDS))) { logger.error("NettyServer shutdown failed after waiting for 30 seconds"); nettyMetrics.nettyServerShutdownError.inc(); } } catch (InterruptedException e) { logger.error("NettyServer termination await was interrupted. Shutdown may have been unsuccessful", e); nettyMetrics.nettyServerShutdownError.inc(); } finally { long shutdownTime = System.currentTimeMillis() - shutdownBeginTime; logger.info("NettyServer shutdown took {} ms", shutdownTime); nettyMetrics.nettyServerShutdownTimeInMs.update(shutdownTime); } } } NettyServer(NettyConfig nettyConfig, NettyMetrics nettyMetrics,
      Map<Integer, ChannelInitializer<SocketChannel>> channelInitializers); }
NettyServer implements NioServer { @Override public void shutdown() { logger.info("Shutting down NettyServer"); if (bossGroup != null && workerGroup != null && (!bossGroup.isTerminated() || !workerGroup.isTerminated())) { long shutdownBeginTime = System.currentTimeMillis(); workerGroup.shutdownGracefully(); bossGroup.shutdownGracefully(); try { if (!(workerGroup.awaitTermination(30, TimeUnit.SECONDS) && bossGroup.awaitTermination(30, TimeUnit.SECONDS))) { logger.error("NettyServer shutdown failed after waiting for 30 seconds"); nettyMetrics.nettyServerShutdownError.inc(); } } catch (InterruptedException e) { logger.error("NettyServer termination await was interrupted. Shutdown may have been unsuccessful", e); nettyMetrics.nettyServerShutdownError.inc(); } finally { long shutdownTime = System.currentTimeMillis() - shutdownBeginTime; logger.info("NettyServer shutdown took {} ms", shutdownTime); nettyMetrics.nettyServerShutdownTimeInMs.update(shutdownTime); } } } NettyServer(NettyConfig nettyConfig, NettyMetrics nettyMetrics,
      Map<Integer, ChannelInitializer<SocketChannel>> channelInitializers); @Override void start(); @Override void shutdown(); }
NettyServer implements NioServer { @Override public void shutdown() { logger.info("Shutting down NettyServer"); if (bossGroup != null && workerGroup != null && (!bossGroup.isTerminated() || !workerGroup.isTerminated())) { long shutdownBeginTime = System.currentTimeMillis(); workerGroup.shutdownGracefully(); bossGroup.shutdownGracefully(); try { if (!(workerGroup.awaitTermination(30, TimeUnit.SECONDS) && bossGroup.awaitTermination(30, TimeUnit.SECONDS))) { logger.error("NettyServer shutdown failed after waiting for 30 seconds"); nettyMetrics.nettyServerShutdownError.inc(); } } catch (InterruptedException e) { logger.error("NettyServer termination await was interrupted. Shutdown may have been unsuccessful", e); nettyMetrics.nettyServerShutdownError.inc(); } finally { long shutdownTime = System.currentTimeMillis() - shutdownBeginTime; logger.info("NettyServer shutdown took {} ms", shutdownTime); nettyMetrics.nettyServerShutdownTimeInMs.update(shutdownTime); } } } NettyServer(NettyConfig nettyConfig, NettyMetrics nettyMetrics,
      Map<Integer, ChannelInitializer<SocketChannel>> channelInitializers); @Override void start(); @Override void shutdown();  }