Remote startup / Shudown of a netty server

이희승 (Trustin Lee) trustin at gmail.com
Thu Jan 27 21:29:33 EST 2011


It's OK to use the same thread pool as long as it can lend enough threads (ie. cached thread pool).  Therefore your code looks fine. :)

Brendt <draco2k4 at yahoo.com> wrote:

>
>Hi Trustin,
>
>Thanks for the reply.  
>My stop method only stops that particular proxy, so I'm not terminating
>the
>Java process in that method.  On terminating all the resources used by
>that
>NioServerSocketChannelFactory... I construct ALL my proxies using the
>same
>boss and worker thread pools, so if I call
>myNioServerSocketChannelFactory.releaseExternalResources() all of my
>proxies
>will terminate.  Am I wrong in using the same boss/worker thread pools
>in
>all of my proxies (should I instead construct new boss/worker thread
>pools
>per proxy?).  I use the same concept for my proxy connections to the
>backend
>server.  So each NioClientSocketChannelFactory uses the same
>boss/worker
>thread pool.
>
>...
>// Shared Executors 
>// one set for proxies (web -> proxy)
>// another for backend servers (proxy -> apache/nginx/tomcat/etc.)
>Executor proxyBoss = Executors.newCachedThreadPool();
>Executor proxyWorker = Executors.newCachedThreadPool();
>Executor serverBoss = Executors.newCachedThreadPool();
>Executor serverWorker = Executors.newCachedThreadPool();
>...
>ChannelFactory proxyFactory1 = new
>NioServerSocketChannelFactory(proxyBoss,
>proxyWorker);
>ChannelFactory proxyFactory2 = new
>NioServerSocketChannelFactory(proxyBoss,
>proxyWorker);
>
>ChannelFactory serverFactory1 = new
>NioServerSocketChannelFactory(serverBoss, serverWorker);
>ChannelFactory serverFactory2 = new
>NioServerSocketChannelFactory(serverBoss, serverWorker);
>...
>
>I hope the code is a better explanation :)
>-- 
>View this message in context:
>http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Remote-startup-Shudown-of-a-netty-server-tp5925249p5967665.html
>Sent from the Netty User Group mailing list archive at Nabble.com.
>_______________________________________________
>netty-users mailing list
>netty-users at lists.jboss.org
>https://lists.jboss.org/mailman/listinfo/netty-users

--
Trustin Lee, http://gleamynode.net/
Sent from a mobile device. Please excuse my brevity.



More information about the netty-users mailing list