You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Serkan Demir <se...@oksijen.com> on 2006/03/29 06:56:23 UTC

Adding ThreadPools Filters to connectors and acceptors

Hello,
I have been implementing  peer-to-peer message processing and sending 
mechanism by using MINA. I have examined all examples. I have a question 
on addition of thread pools filters to connectors and acceptors. I have 
been using a modified version of SimpleServiceRegistry for server-side 
actions and using its thread pool filters for socket protocol acceptor. 
On the same process, i have added a IoProtocolConnector for connecting a 
peer and opening a session. Do I have to add thread pool filters to my 
connector for scalability similar to below lines? If answer is yes, may 
i use the same thread pool which i used for acceptors? Or should i 
create and use a new pool ?
        
connector.getIoConnector().getFilterChain().addFirst("threadPool",ioThreadPoolFilter);
        connector.getFilterChain().addFirst("threadPool", 
protocolThreadPoolFilter);

thanks lot,

Serkan


Re: Adding ThreadPools Filters to connectors and acceptors

Posted by Trustin Lee <tr...@gmail.com>.
Hi Serkan,

On 3/29/06, Serkan Demir <se...@oksijen.com> wrote:
>
> Hello,
> I have been implementing  peer-to-peer message processing and sending
> mechanism by using MINA. I have examined all examples. I have a question
> on addition of thread pools filters to connectors and acceptors. I have
> been using a modified version of SimpleServiceRegistry for server-side
> actions and using its thread pool filters for socket protocol acceptor.
> On the same process, i have added a IoProtocolConnector for connecting a
> peer and opening a session. Do I have to add thread pool filters to my
> connector for scalability similar to below lines? If answer is yes, may
> i use the same thread pool which i used for acceptors? Or should i
> create and use a new pool ?
>
> connector.getIoConnector
> ().getFilterChain().addFirst("threadPool",ioThreadPoolFilter);
>         connector.getFilterChain().addFirst("threadPool",
> protocolThreadPoolFilter);


You can use the same thread pool.   A thread pool can be shared by multiple
services, but it can be risky when one service locks down the pool.

As of MINA 0.9.3, you don't need to add a thread pool by yourself.  It is
added by default.

HTH,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6