Hi Pete,

peter royal wrote:

On Apr 21, 2006, at 10:16 AM, Michael Bauroth wrote:

just a short question. In your tutorial you describe a combination of filters and ThreadPool for CPU intensive jobs. When I want to use time consuming SQL operations, would it be better to locate them in the filter / decoder part before the ThreadPoolFilter or is it equal to handle them in the IoSession.messageReceived method (don't matter)?


You want to do them after the ThreadPoolFilter. That way they will occur on separate threads, and not block the thread that reads from the nio Selector.

I'd say the general "recommended" way would be:

Processor -> ThreadPoolFilter -> {custom filters} -> ProtocolDecoderFilter -> {custom filters} -> IoHandler

.. Just do everything that could take a non-trivial amount of time after the ThreadPoolFilter :)

-pete




In the actual tutorial I've found the following scheme:

Acceptor (Processor) -> ThreadPoolFilter (now implemented in processor by default as BufferPool) -> CPU int. job -> ThreadPoolFilter -> IoHandler

So can (should) I forget this scheme, especially the second ThreadPoolFilter? :)

Regards
Michael


Reply via email to