How to create channel pool in netty?

12.3k Views Asked by At

I am creating channel using this sample code:

 EventLoopGroup group = new NioEventLoopGroup();
        try {
            Bootstrap b = new Bootstrap();
            b.group(group)
             .channel(NioSocketChannel.class)
             .option(ChannelOption.SO_KEEPALIVE, true)
             .handler(new ClientInitializer());

            // Start the connection attempt.
            Channel ch = b.connect(host, port).sync().channel();

So here my getting a channel(channel future) but my application throughput will be very high so i think that one channel will not be sufficient, so please let me know that how do i create channel pool.

I am using netty 4.0

1

There are 1 best solutions below

7
On BEST ANSWER

Please refer ChannelPool section at http://netty.io/news/2015/05/07/4-0-28-Final.html