NioServerSocketChannel with only one worker thread
lepe
lennart.petersson at redpill-linpro.com
Tue Jan 25 03:39:48 EST 2011
Thanks for fast response!
Yeah, I'm aware of that it does not mean 'only one connection' and that is
fine. I can accept many connections but say I only want 4 dealing with I/O
at the same time. I thought that this constructor would give me same
behavior as following, that works as I expects:
bossExecutor = Executors.newCachedThreadPool();
workerExecutor = Executors.newFixedThreadPool(1); // setting 1 for test
factory = new NioServerSocketChannelFactory(bossExecutor, workerExecutor);
With this code I can have say two clients making connections but only one of
them can have their sent data streams handled in the pipeline, the other
waiting for the first one to complete.
/L
setting workerCount to 1 does not mean "only one connection at the
same time", but "only one thread is dealing with I/O".
Have a look at handler like
http://james.apache.org/protocols/apidocs/org/jboss/netty/handler/connection/ConnectionPerIpLimitUpstreamHandler.html
in order to limit the number of simultaneous incoming connections.
--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/NioServerSocketChannel-with-only-one-worker-thread-tp5957831p5957941.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list