directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trustin Lee <>
Subject Re: [mina] sumup example question - thread pools
Date Tue, 05 Apr 2005 11:31:52 GMT

I'm sorry for a late reply.

On Apr 4, 2005 3:29 PM, Vinod Panicker <> wrote:
> Hi,
> Had a question regarding the impl of thread pools in the sumup example.
> Basically in the client, I noticed this code -
>        IoThreadPoolFilter ioThreadPoolFilter = new IoThreadPoolFilter();
>        ProtocolThreadPoolFilter protocolThreadPoolFilter = new
> ProtocolThreadPoolFilter();
> From my understanding, both these filters are providing thread pools.
> Doesnt it make it unnecessary to use both these filters at the same
> time?

Protocol layer works upon I/O layer.  So, decoding and encoding occurs
in I/O thread pool and protocol events are fired from I/O thread pool
thread.  And then ProtocolHandler received events.  If you add
ProtocolThreadPoolFilter, then events are passed to protocol thread
pool filter and forwarded at a different thread.  This is because
ProtocolHandler will contain more complex business logic.  Codecs
usually consume CPU mostly, but I suspect ProtocolHandler will perform
different kind of operations such as disk I/O, DB access, etc.  If
your protocol handler implementation is CPU intensive, you'll be able
to use thread pool filter only at I/O layer.

what we call human nature is actually human habit

View raw message