2

I use the netty3.4.2 connect to the server util the server startup the code is:

ThreadPoolExecutor bossExecutor = new ThreadPoolExecutor(1, 5, 20L, TimeUnit.SECONDS,new SynchronousQueue<Runnable>(),new ThreadPoolExecutor.CallerRunsPolicy());

ThreadPoolExecutor workerExecutor = new ThreadPoolExecutor(1, 10, 20L, TimeUnit.SECONDS,new SynchronousQueue<Runnable>(),new ThreadPoolExecutor.CallerRunsPolicy());

NioClientSocketChannelFactory clientSocketChannelFactory = new NioClientSocketChannelFactory(bossExecutor,workerExecutor);

ClientBootstrap clientBootstrap = new ClientBootstrap(clientSocketChannelFactory);

...
...

clientBootstrap.connect(..);

Invoke the connect method, the server is closed. Then reConnect the server ,but result in more threads?

4

0 回答 0