Hi Owen,

do you have a full working test demonstrating the problem?

It would be best to create a JIRA, and attach the test.

Thanks !

On Fri, May 30, 2008 at 6:49 PM, Owen Gu <[EMAIL PROTECTED]> wrote:
> Please try following testing code, you will find if the NioProcessor counts
> are 100, when the server accept and close more than 100 connections, there
> will have 100 NioSocketSession instance live forever. Can anyone tells me
> why, is this a mina 2.0-m1 bug?
>
> import java.net.InetSocketAddress;
>
> import org.apache.mina.common.IdleStatus;
> import org.apache.mina.common.IoHandler;
> import org.apache.mina.common.IoSession;
> import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
>
> public class Transport
> {
>    private static class Hanlder implements IoHandler
>    {
>        public void exceptionCaught(IoSession session, Throwable cause)
> throws Exception
>        {
>            session.close();
>        }
>
>        public void messageReceived(IoSession session, Object message)
> throws Exception
>        {
>        }
>
>        public void messageSent(IoSession session, Object message) throws
> Exception
>        {
>        }
>
>        public void sessionClosed(IoSession session) throws Exception
>        {
>            session.close();
>            System.out.println("sessionClosed");
>        }
>
>        public void sessionCreated(IoSession session) throws Exception
>        {
>            session.getConfig().setBothIdleTime(1);
>            System.out.println("sessionCreated");
>        }
>
>        public void sessionIdle(IoSession session, IdleStatus status) throws
> Exception
>        {
>            session.close();
>        }
>
>        public void sessionOpened(IoSession session) throws Exception
>        {
>            System.out.println("sessionOpened");
>            session.close();
>        }
>    }
>
>    public static void main(String[] arg)
>    {
>        try
>        {
>            NioSocketAcceptor acceptor = new NioSocketAcceptor(100);
>            acceptor.setReuseAddress(true);
>            acceptor.getSessionConfig().setReuseAddress(false);
>            acceptor.getSessionConfig().setReceiveBufferSize(1024);
>            acceptor.getSessionConfig().setSendBufferSize(1024);
>            acceptor.getSessionConfig().setTcpNoDelay(true);
>            acceptor.getSessionConfig().setSoLinger(-1);
>            acceptor.setBacklog(50);
>            acceptor.setHandler(new Hanlder());
>            acceptor.bind(new InetSocketAddress("0.0.0.0", 51127));
>        }
>        catch (Exception ex)
>        {
>        }
>    }
> }
>



-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Reply via email to