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 Thu, 07 Jun 2007 10:24:07 GMT
Hi Messi,

On 6/7/07, Messi Chan <chencao0524@gmail.com> wrote:
>
> Hi, all
> I have read this article
> http://mina.apache.org/configuring-thread-model.html
> http://mina.apache.org/configuring-thread-model.html . At the end of the
> article, author suggest us not share one thread pool for IoServices and
> ExecutorFilters, and better to use a cached thread pool for IoServices.
>
> Is that means if I add only one thread pool to IoFilterChain, then the  I/O
> processor would acquire a thread from the shared pool? So, adding two thread
> pools would be OK? like below.
>
> SocketAcceptorConfig config = (SocketAcceptorConfig)
> acceptor.getDefaultConfig();
> config.setThreadModel(ThreadModel.MANUAL);
> ExecutorService executor1 = Executors.newCachedThreadPool();
> config.getFilterChain().addLast("pool1", new ExecutorFilter(executor1));
> ExecutorService executor2 = Executors.newCachedThreadPool();
> config.getFilterChain().addLast("pool2", new ExecutorFilter(executor2));
>
> Am I right? if wrong, how?

Wrong.  The executor for I/O processor threads is specified in the
constructor.  For example:

SocketAcceptor acceptor = new SocketAcceptor(Executors.newCachedThreadPool());

Adding two executor filter might not work, but please give it a try.

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

Mime
View raw message