http://mina.apache.org/reporting-a-bug.html

On 1/23/07, sishen <[EMAIL PROTECTED]> wrote:

In my application,  i use mina 1.1 version.

Now i do some perfermance test.  Below is my test case.

loop (50) {
     client send message to server. (500 client one time).
     sleep 1s.
}

And  in the executing,  the server stop response. It just hang.  However,
sometimes it passed the test.

I sniff the network using tcpdump.  And i found that the packet is
received
by the server machine, but no log output in the code decode part.
So I think it even don't go to the doDecode step. It's very strange, and i

don't know the reason.

Thank you for you advice. Below is the related code.

The code of server side:

public class BIIServer {
    private static final int port = 12345;
    private static BIIServerSessionHandler handler = new
BIIServerSessionHandler();

    public static void main(String[] args) throws Exception
    {
        try {
            Executor executor = Executors.newCachedThreadPool();
            SocketAcceptor acceptor = new
SocketAcceptor(Runtime.getRuntime().availableProcessors(),
executor);
            ExecutorThreadModel model = ExecutorThreadModel.getInstance
("BIIServer");
            model.setExecutor(executor);
            acceptor.getFilterChain().addLast("codec", new
ProtocolCodecFilter(new BIProtocolCodecFactory(true)));
            acceptor.getFilterChain().addLast("threadpool", new
ExecutorFilter(executor));
            SocketAcceptorConfig config = new SocketAcceptorConfig();
            config.setReuseAddress(true);
            acceptor.bind(new InetSocketAddress(port), handler, config);
            System.out.println ("Server now listening on port: " + port);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}

The code of client side:

    public UIDMessage orderUID(OrderUIDMessage message) {
        IoSession session;
        Object lock = new Object();
        for ( ; ; ) {
            try {
                ConnectFuture future = connector.connect(new
InetSocketAddress(host, port), handler, cfg);
                future.join();
                session = future.getSession();
                session.setAttribute("lock", lock);
                break;
            } catch (RuntimeIOException ex) {
            } catch (InterruptedException e) {
            }
        }
        session.write(message);
        synchronized (lock) {
            try {
                while (session.getAttachment() == null) {
                    lock.wait();                    <-   I use this to
ensure i receive the result message.  But due to the problem, it was made
to
wait indefinitely.
                }
            } catch (InterruptedException ex) {
                ex.printStackTrace();
            }
        }
        UIDMessage UID = (UIDMessage)session.removeAttribute("");
        sessionMap.put(UID.getUid(), session);
        return UID;
    }




--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6

Reply via email to