[EMAIL PROTECTED] wrote:
> Hi,
>
> My application is Spring-based, and I use
> DefaultIoFilterChainBuilderFactoryBean to add some filters, including a
> ThreadPoolFilter.
>
> I am switching to Mina 0.9.4, and I wonder what to do with
> ThreadPoolFilter.
>
> I have read e-mails in this list stating that Mina 0.9.4 automatically
> adds ThreadPoolFilter, but I don't know if it does so when setting my
> own IoFilterChainBuilder.
>
> I don't want to end up with several thread pools.
>
> My preference is to keep it in Spring XML context. Should I change
> anything in my code for the upgrade?
The default thread model is the PooledThreadModel. The thread model will
be applied regardless of whether you set up your own
IoFilterChainBuilder. This means that you'll end up with two
ThreadPoolFilters if you just upgrade without changing your spring
config file.
You need to set the ThreadModel.MANUAL thread model if you still want to
configure the ThreadPoolFilter using Spring:
<bean id="org.apache.mina.common.ThreadModel.MANUAL"
class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean"/>
<bean id="acceptorConfig"
class="org.apache.mina.transport.socket.nio.SocketAcceptorConfig">
<property name="threadModel"
ref="org.apache.mina.common.ThreadModel.MANUAL"/>
</bean>
Use the acceptorConfig when binding from your Spring file. For now
there's no way to set the defaultConfig property since it is read only.
I think this should work. I'm still not using 0.9.4 myself with Spring
so no guarantees... ;) Let me know if you run into any problems.
--
Niklas Therning
Software Architect
www.spamdrain.net