normanmaurer / netty-in-action

2.08k stars 1.77k forks source link

Chapter 2 Echo Client/Server takes long to startup #8

Open chhil opened 10 years ago

chhil commented 10 years ago

The following takes quite a few seconds to instantiatie class io.netty.channel.socket.nio.NioServerSocketChannel

Thread [main] (Suspended)   
    AbstractBootstrap$BootstrapChannelFactory<T>.newChannel() line: 445 
    ServerBootstrap(AbstractBootstrap<B,C>).initAndRegister() line: 298 
    ServerBootstrap(AbstractBootstrap<B,C>).doBind(SocketAddress) line: 273 
    ServerBootstrap(AbstractBootstrap<B,C>).bind() line: 237    
    EchoServer.start() line: 41 
    EchoServer.main(String[]) line: 57  

The same place (line 445) takes a long to instantiate the class for the echoclient too. Loading class io.netty.channel.socket.nio.NioSocketChannel Why could it possible take so long? It does eventually run and communicate.

Using JDK 1.7 latest update Netty netty-4.1.0.Beta3

-chhil

splade commented 9 years ago

Netty will allocate some pooled data structure. so it take a little longer time to start.