Hi,
I'm doing currently my first steps with the Springbased approach in
Mina. Now I have a few questions how to convert my old code to the new
style:
1. I'm configuring an alternate SocketAcceptor over the config file,
which will be used for the later binding.
<property name="serviceConfig">
<bean class="org.apache.mina.transport.socket.nio.SocketAcceptorConfig">
<property name="filterChainBuilder" ref="filterChainBuilder"/>
<property name="reuseAddress" value="false"/>
<property name="disconnectOnUnbind" value="false"/>
</bean>
</property>
When I check the settings after server start, I get other values than
specified. Here is the related code:
System.out.println("Starting server ...");
System.out.println("UseDirectBuffers " + ByteBuffer.isUseDirectBuffers());
System.out.println("DisconnectOnUnbind " +
((SocketAcceptorConfig)mAcceptor.getDefaultConfig()).isDisconnectOnUnbind());
System.out.println("ReuseAddress " +
((SocketAcceptorConfig)mAcceptor.getDefaultConfig()).isReuseAddress());
What I'm doing wrong?
2. In the original code I have specified some extra settings:
SocketSessionConfig tSessionConfig =
(SocketSessionConfig)mAcceptorConfig.getSessionConfig();
tSessionConfig.setReuseAddress( REUSE_ADDRESS );
tSessionConfig.setTcpNoDelay( TCP_NO_DELAY );
tSessionConfig.setSendBufferSize( TCP_SND_BUFFER_SIZE );
tSessionConfig.setReceiveBufferSize( TCP_RCV_BUFFER_SIZE );
tSessionConfig.setSoLinger( SO_LINGER );
tSessionConfig.setOobInline( OOB_INLINE );
tSessionConfig.setKeepAlive( KEEP_ALIVE );
How can I specify these settings over the configuration xml file?
3. How can I request the SocketAddress from an acceptor after binding? I
can't find a related method?
I hope, somebody can help me with some short advices ...
Thanx in advance!
Michael