NioServerSocketChannel with only one worker thread
이희승 (Trustin Lee)
trustin at gmail.com
Wed Jan 26 11:32:21 EST 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Your idea about using fixed thread pool will not work with Netty. What you are looking for is to append an integer parameter to the factory's constructor to adjust the number of io threads.
"lepe" <lennart.petersson at redpill-linpro.com> wrote:
>
>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.
>_______________________________________________
>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.
-----BEGIN PGP SIGNATURE-----
Version: APG v1.0.8
iIkEAREIADEFAk1ATJUqHFRydXN0aW4gSGV1aXNldW5nIExlZSA8dHJ1c3RpbkBn
bWFpbC5jb20+AAoJEJb7nbIZ8zON3YoA/AmDPxl6TxCcW19WBxVedWksMj85A1oP
cA2z7WZwTuFYAP9UhHYVrDj50nAzs83f5y+c0Xp1ooEJZsA5oBL/4I5QOQ==
=rSwq
-----END PGP SIGNATURE-----
More information about the netty-users
mailing list