mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trustin Lee" <trus...@gmail.com>
Subject Re: How could I set thread pool for IoServices and ExecutorFilters?
Date Fri, 08 Jun 2007 03:06:48 GMT
On 6/7/07, Messi Chan <chencao0524@gmail.com> wrote:
>
> Hi, Trustin, thx for your reply.
>
> According to your advice, I modify those codes below:
>
> ExecutorService executor1 = Executors.newCachedThreadPool();
> SocketAcceptor acceptor = new SocketAcceptor(executor1);
> SocketAcceptorConfig config = (SocketAcceptorConfig)
> acceptor.getDefaultConfig();
> config.setThreadModel(ThreadModel.MANUAL);
> ExecutorService executor2 = Executors.newCachedThreadPool();
> config.getFilterChain().addLast("pool", new ExecutorFilter(executor2));
>
> It's correct now? But, what the difference between these two pool? Is
> executor1 only used by I/O processor? and  executor2 work for the IoFilters
> after it in the IoFilterChain, also work for the following IoHandler?

Exactly.

> And other, you said"Adding two executor filter might not work, but please
> give it a try." Is that means adding only one thread pool into IoFilterChain
> is enough, and the other pools are redundant? en...
> http://mina.apache.org/configuring-thread-model.html
> http://mina.apache.org/configuring-thread-model.html  said that"You can add
> any number of ExecutorFilter anywhere in the IoFilterChain to implement any
> kind of thread model". What it do for me if I add multi-pools in the
> IoFilterChain?

In most cases adding only one executor filter will suffice.
Currently, more than two ExecutorFilters can't be added to a single
chain due to technical limitation.  But the limitation will be removed
in MINA 2.0.

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Mime
View raw message