How to define one thread for multiple connections?

hada hadassa.koen at gmail.com
Thu Nov 25 03:46:06 EST 2010


OK. I will precise my question:
if you define the NioServerSocketChannelFactory as
new
NioServerSocketChannelFactory(Executors.newSingleThreadExecutor(),Executors.newSingleThreadExecutor()),
only one workerThread will be created.
Say that the client sends "Hello, I'm client" message and the server
responds with a "hello, I'm server" and then the client re-send "Hello, i'm
client" etc.... 
for the first client this message exchange happens, but no for a second
client. This is because only a single thread is allowed for workerThread in
NioServerSocketChannelFactory.
Only when the first client will be disconnected, the second one will
"receives" the thread, and then the message exchange will start.
(however, in the netstat i see that the connection is established for the 2
clients, although only the first client is 'active')

What I want is that only one thread will be manage the exchange message for
many connections!



-- 
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/How-to-define-one-thread-for-multiple-connections-tp5773292p5773426.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list