I'm using mina 1.1.6 to connect to a TCP server.  Everything is
working, encoder/decoder and the IoHandler.  I'm having an issue
understanding the thread model.  I'm having some thoughts as to
whether threads are actually being spun off when IoHandler is invoked.
 The actions we're performing are rather lite, so I used a profiler to
capture a few snapshots.  Each one revealed only one IoHandler thread
being executed at a particular time.

My configuration is as follows, I extracted only the relevant lines...


ExecutorService executor = Executors.newFixedThreadPool(threadDefault);
config.getFilterChain().addLast("to-operation", new
ProtocolCodecFilter(codecFactory));
config.getFilterChain().addLast("executor", new ExecutorFilter(executor));

try {
 acceptor.bind(instance.getAddress(), new ChainedIoHandler(handler), config);
}
catch (IOException e) {
 e.printStackTrace();
}


The executor is added to the filter chain last, as per documentation
on the mina site, but I was also having a hard time understanding the
small snippet of documentation that explained the thread model usage,
so I'm not positive that by pushing the executor service into the
filter chain would make it execute each IoHandler in its own thread.

Thanks.

Reply via email to