mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niklas Therning <nik...@trillian.se>
Subject Re: 3 questions regarding Mina and Spring
Date Wed, 02 Aug 2006 05:58:36 GMT
Michael Bauroth wrote:
> Hi Niklas,
> thank you very much for your help!!! Here is my modified and optimized
> config part:
> <bean id="acceptor"
> class="org.apache.mina.transport.socket.nio.SocketAcceptor"/>
> <bean id="defaultAcceptorConfig" factory-bean="acceptor"
> factory-method="getDefaultConfig">
>   <property name="filterChainBuilder" ref="filterChainBuilder"/>
>   <property name="reuseAddress" value="false"/>
>   <property name="disconnectOnUnbind" value="true"/>
> </bean>
> <bean id="sessionConfig" factory-bean="defaultAcceptorConfig"
> factory-method="getSessionConfig">
>   <property name="reuseAddress" value="false"/>
>   <property name="tcpNoDelay" value="true"/>
>   <property name="sendBufferSize" value="1024"/>
>   <property name="receiveBufferSize" value="1024"/>
>   <property name="soLinger" value="10"/>
>   <property name="oobInline" value="false"/>
>   <property name="keepAlive" value="true"/>
> </bean>
> <bean id="ioAcceptor"
> class="org.apache.mina.integration.spring.IoAcceptorFactoryBean">
>   <property name="target" ref="acceptor"/>
>   <property name="bindings">
>     <list>
>       <bean class="org.apache.mina.integration.spring.Binding">
>         <property name="address" value=":1234"/>
>         <property name="handler" ref="TcpServerSessionHandler"/>
>         <property name="serviceConfig" ref="defaultAcceptorConfig"/>
>       </bean>
>     </list>
>   </property>
> </bean>
Looks great! One little thing, you don't have to set the serviceConfig
in your Binding anymore since you have configured the default already.

>  >>3. How can I request the SocketAddress from an acceptor after binding?
>>> I can't find a related method?
>> AFAIK you can't. There is an isBound() method but you probably want
>> something like getBoundAdresses(), right? That should be easy enough to
>> add, at least to SocketAcceptor. I'll have a look at it.
> Thanx it advance!
I've just added the getBoundAddresses() method to IoAcceptor. Just grab
the latest code and it will be there.
>> BTW, what do you and others think about adding a setDefaultConfig() to
>> the various acceptors and connectors (adding it to the IoService
>> interface will loose type safety so I don't think that's a good idea)
>> and setSessionConfig() to the various acceptor config and connector
>> config classes (like SocketAcceptorConfig)? I realize that this will
>> probably only be useful for users using Spring and other DI containers
>> but for those users it will simplify things a lot. WDYT?
> I think it would be a good idea. Generally spoken it would be a good
> idea to implement always setter / getter pairs whereever it is
> possible and useful to simplify the things. WDYT?
I will add a JIRA issue for this. Also, with Spring 2.0 coming out very
soon we should look into simplifying the Spring integration using
Spring's custom XML configuration feature. It would make life a lot
simpler for Spring users.
Niklas Therning
Software Architect

View raw message