On 10/18/10 11:43 AM, Zlatko Josic wrote:
Hi,
Can anyone explain me diffrence between solution 1 and solution 2.
Solution 1 :
config.getFilterChain().addLast("executor", new ExecutorFilter());
config.getFilterChain().addLast(
"codec",
new ProtocolCodecFilter(new TextLineEncoder( new LineDelimiter("\n\r")),
new TextLineDecoder(Charset.forName("Cp1250"), LineDelimiter.AUTO)));
Solution 2 :
config.getFilterChain().addLast(
"codec",
new ProtocolCodecFilter(new TextLineEncoder( new LineDelimiter("\n\r")),
new TextLineDecoder(Charset.forName("Cp1250"), LineDelimiter.AUTO)));
config.getFilterChain().addLast("executor", new
ExecutorFilter());
Thank you.
In the first case, as the executor is the fist one in the filters chain,
you may not be able to deal with fragmented messages, as one part may be
processed by one thread, and the other parts by some other threads.
I suggest that you put the executor at the end of your chain, unless the
decoding is the most expensive process in your chain (ie more expensive
than the handlers operations).
However, you can force the executor to always use the same thread for
message coming from a session, but this will not allow you to process
messages in parallel for this session.
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com