You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by milel <mi...@gmail.com> on 2007/02/02 06:30:35 UTC

Is there any example about how to make a connector-threadPool?

we are working at a mid-tie-server use own protocol
now we need to forward a message from client to the end-server in  
handler.messageReceived(),so i think socketPool is the best choice,but 
cant find any example about this in mina's example.
can any one show me any thing about of it ?
thanks very much.

Re: Is there any example about how to make a connector-threadPool?

Posted by milel <mi...@gmail.com>.
Trustin Lee wrote:
> Hello Milel,
>
> On 2/2/07, milel <mi...@gmail.com> wrote:
>>
>> we are working at a mid-tie-server use own protocol
>> now we need to forward a message from client to the end-server in
>> handler.messageReceived(),so i think socketPool is the best choice,but
>> cant find any example about this in mina's example.
>> can any one show me any thing about of it ?
>> thanks very much.
>
>
> There's no difference in applying a thread model to an IoConnector.  It's
> same with IoAcceptor.  Here's an example:
>
> IoConnector connector;
> // disable unintuitive ThreadModel property
> connector.getDefaultConfig().setThreadModel(ThreadModel.MANUAL);
>
> connector.getFilterChain().addLast(
>        "threadPool", new 
> ExecutorFilter(Executors.newCachedThreadPool()));
>
> HTH,
> Trustin
thanks,i'm trying now.

Re: Is there any example about how to make a connector-threadPool?

Posted by Trustin Lee <tr...@gmail.com>.
Hello Milel,

On 2/2/07, milel <mi...@gmail.com> wrote:
>
> we are working at a mid-tie-server use own protocol
> now we need to forward a message from client to the end-server in
> handler.messageReceived(),so i think socketPool is the best choice,but
> cant find any example about this in mina's example.
> can any one show me any thing about of it ?
> thanks very much.


There's no difference in applying a thread model to an IoConnector.  It's
same with IoAcceptor.  Here's an example:

IoConnector connector;
// disable unintuitive ThreadModel property
connector.getDefaultConfig().setThreadModel(ThreadModel.MANUAL);

connector.getFilterChain().addLast(
        "threadPool", new ExecutorFilter(Executors.newCachedThreadPool()));

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