directory-dev mailing list archives

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

I'm sorry for a late reply.

On Apr 4, 2005 3:29 PM, Vinod Panicker <vinod.p@gmail.com> 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.

Regards,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/

Mime
View raw message