Hello everyone , I'm newbie to mina ~~

A strange behavior of mina comfuses me a lot , and I came here for answers.

I use mina for very simple purpose : read request from client ,and send result 
back, no additional protocal en/decode,no additional filter.

But after long time of online service, I found that mina would stop listenning 
on port occasionally, and no exceptions found in log message output, no OOM.

here comes my code..

mina startup code:

        NioSocketAcceptor acceptor = new 
NioSocketAcceptor(CoConfig.getSearcherConcurrentRunCount());
        TextLineCodecFactory codec = new 
TextLineCodecFactory(Charset.forName("GBK"));
        codec.setDecoderMaxLineLength(Integer.MAX_VALUE);

        acceptor.setBacklog(CoConfig.getSearcherBackLog());
        acceptor.getFilterChain().addLast("codec", new 
ProtocolCodecFilter(codec));
        acceptor.getFilterChain().addLast("ThreadPool",new 
ExecutorFilter(Executors.newCachedThreadPool()));
        acceptor.getSessionConfig().setKeepAlive(false);
        acceptor.getSessionConfig().setTcpNoDelay(true);
        acceptor.getSessionConfig().setReadBufferSize(256);
        
acceptor.getSessionConfig().setWriteTimeout(CoConfig.getSearcherIdleTimeout());
        
acceptor.getSessionConfig().setBothIdleTime(CoConfig.getSearcherIdleTimeout());
        acceptor.setReuseAddress(true);
        acceptor.setHandler(new SeServiceHandler());

        try
        {
            String ipaddr = CoConfig.getSearcherBindAddress();
            port = CoConfig.getSearcherPort();

            SocketAddress sa = null;

            if (!ipaddr.toUpperCase().equals("ALL"))
                sa = new InetSocketAddress(ipaddr, port);
            else
                sa = new InetSocketAddress(port);

            acceptor.bind(sa);
            log.info("Service started at Port " + ipaddr + ":" + port);
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }




Reply via email to