Serge Baranov wrote:
Hello All,

Follow-up:

It's indeed caused by the sessionClosed called before the
sessionOpened.

I've added some debug output which showed that the reported number of
connections differs from the actual number of connections by the value
of sessionClosed calls before the sessionOpened calls.

The initialization for acceptor is as follows:

acceptor = new NioSocketAcceptor();
acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(...));
accExecutor = new OrderedThreadPoolExecutor(...);
acceptor.getFilterChain().addLast("threadPool", new 
ExecutorFilter(accExecutor));

Quoting the ExecutorFilter JavaDoc:

"Event Ordering

All convenience constructors of this filter creates a new
OrderedThreadPoolExecutor instance. Therefore, the order of event is
maintained like the following:

* All event handler methods are called exclusively. (e.g.
messageReceived and messageSent can't be invoked at the same time.)

* The event order is never mixed up. (e.g. messageReceived is always
invoked before sessionClosed or messageSent.)"
This is not exactly what the OrderedThreadPoolExecutor does. It just guarantee that the events are handled in the order they arrived. It uses a queue internally to keep the order.

Otherwise, regarding your problem, after a quick search in the mailing list (dev), it seems that there might be a problem with the sessionClosed being called before the sessionOpened has been totally executed.

One good example of code which is very simular to what you want to do is the firewall sample.


--
--
cordialement, regards,
Emmanuel Le'charny
www.iktek.com
directory.apache.org


Reply via email to