Michael Bauroth wrote:
> Thank you for your answer. Just one last question about the topic of
> threadpools in this context.
>
> Can I add the snippet:
>
> <bean class="org.apache.mina.filter.thread.ThreadPoolFilter">
>   <constructor-arg>
>     <bean
> class="org.apache.mina.filter.thread.LeaderFollowersThreadPool">
>       <property name="threadNamePrefix" value="IoWorker"/>
>       <property name="maximumPoolSize" value="16"/>
>       <property name="keepAliveTime" value="60000"/>
>     </bean>
>   </constructor-arg>
> </bean>
>
> once at the beginning of the filterchain filters list and once more at
> the end to encapsulate more timeconsuming tasks in some of the codecs
> between them?
>
> And last but not least: I didn't understand fully the extended
> threadmodel. What happens, when I use your second approach?
>
>> An alternative to the changes above would be to configure your own
>> PooledThreadModel and remove the ThreadPoolFilter configuration:
>>
>> <bean class="org.apache.mina.transport.socket.nio.SocketAcceptorConfig">
>>   <property name="reuseAddress" value="true"/>
>>   <property name="threadModel">
>>     <bean class="org.apache.mina.common.PooledThreadModel">
>>       <property name="threadNamePrefix" value="IoWorker"/>
>>       <property name="maximumPoolSize" value="16"/>
>>       <property name="keepAliveTime" value="60000"/>
>>     </bean>
>>   </property>
>> </bean>
>
> Is the result already a full functionally threadpool (and if, of what
> kind it is) or must I add some additional code here (e.g. when I want
> to use another threadmodel instead)?
> I hope you know what I mean :)
>

The default ThreadModel is a PooledThreadModel which will create a
ThreadPoolFilter (TPF) (maximumPoolSize=16, keepAlive=60 sec) and add
that to the beginning of your filter chain. My second approach simply
overrides this default with a new PooledThreadModel with some non
default property values.

If you want to configure thread pools yourself you will have to
configure a ThreadModel yourself and set that in the
SocketAcceptorConfig you configure using Spring. The ThreadModel.MANUAL
ThreadModel I used in my first approach is a ThreadModel which doesn't
create any TPF at all. So when using this you will be in full control
over the configuration of the TPF(s).

To have two TPFs as you describe you will have to configure the second
one yourself. You could let MINA configure the first one from the
defaults, you could create a PooledThreadModel in Spring and change
maximumPoolSize and keepAlive to your likings (my second approach in my
previous mail) or you could set the MANUAL ThreadModel and create a TPF
from within Spring (the first approach).

HTH

-- 
Niklas Therning
Software Architect
www.spamdrain.net

Reply via email to