List of usage examples for io.netty.channel.group ChannelGroup close
ChannelGroupFuture close();
From source file:com.zhang.pool.NettyChannelPool.java
License:Apache License
/** * close all channels in the pool and shut down the eventLoopGroup * /*from w w w . j a v a 2s. c o m*/ * @throws InterruptedException */ public void close() throws InterruptedException { ChannelGroup channelGroup = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE); for (LinkedBlockingQueue<Channel> queue : routeToPoolChannels.values()) { for (Channel channel : queue) { removeChannel(channel, null); channelGroup.add(channel); } } channelGroup.close().sync(); group.shutdownGracefully(); }