Hello Daniel, On Feb 18, 2008 4:54 PM, Daniel Cheng <[EMAIL PROTECTED]> wrote:
> Hi list, > > MdcInjectionFilter fails on nested call. It assume only one IoSession on > a thread at any time. yes, that might be an issue, not sure, I will investigate it. Which session info would you expect to be in the MDC, both ? > > > See attached source for a test case. You need both port 21 and 22 open > on localhost to run the test case. If you can't open the attachment, try > http://www.sdiz.net/temp/MainTest.java > > (btw, checkDeadlock() in await() think I have a deadlock when I remove > the Thread.sleep() call on line 39 ... is this bug?) I don't think so. Instead of using cf.await() you should use an IoFutureListener: Your code: public void sessionOpened(final IoSession session) throws Exception { logger.info("[conn2] before connect to conn1"); final ConnectFuture cf = conn1.connect(new InetSocketAddress("localhost", TEST_PORT2)); logger.info("[conn2] after connect to conn1"); Thread.sleep(3000); // WAIT FOR CONNECT cf.await(); // (or await will think this as deadlock) cf.getSession().write(IoBuffer.wrap("HELP\n".getBytes("LATIN1"))); // BUG HERE!!! we have no MDC here!! logger.info("[conn2] after write to conn1"); } Better: public void sessionOpened(final IoSession session) throws Exception { logger.info("[conn2] before connect to conn1"); final ConnectFuture cf = conn1.connect(new InetSocketAddress("localhost", TEST_PORT2)); logger.info("[conn2] after connect to conn1"); final byte[] bytes = "HELP\n".getBytes("LATIN1"); cf.addListener(new IoFutureListener<ConnectFuture>() { public void operationComplete(ConnectFuture future) { future.getSession().write(IoBuffer.wrap(bytes)); logger.info("[conn2] after write to conn1"); } }); } This also solves the MDC problem. Maarten > -- > This space was intended to be left blank. > > > >
