On 10/6/10 9:18 PM, Oleg Kalnichevski wrote:
Take it as a food for thought. Nothing more.
I'm going to give HttpComponents a shoot, to see how those two guys can fit.

One solution would be to define a common base, with all the Filter
intricacy separated from the NIO part. That might fit your need then.

Yeeeep. This is precisely what I was trying to hint at.
Took me a while to figure this out :)
Here is my private fork of HttpCore NIO code with all HTTP specific
stuff ripped out. It might be easier for you to get a feel of the
framework by looking at the protocol independent code.
I have downloaded the original code (httpcore-nio).

A few remarks :
- mvn eclipse:eclipse fails, due to some strange errors with the 'filtering' tags. I removed them, and get the projects available in eclipse - in the select() loop, you will experiment from time to time some 100% CPU usage. This is a known bug in Sun code base. What happens is that select() return something > 0 but no selectionKey are available, because some client simply connect and disconnect immediately, triggering the select() but weren(t present anymore when the selector tried to add a selectionKey in its internal table (a kind of race condition). As a consequence, there is nothing to do, so you immediately return to the select() which returns immeditely with a value > 0 and so on => 100% CPU. See https://issues.apache.org/jira/browse/DIRMINA-678

A fix for the second point consist on detecting that we exit from the select() fast and that we don't have any SelectionKey to process. You have to get the time before entering the select(), the time when you get out, and compare them. If it's almost 0, and if the returned value is > 0, and if there is no selectionKey available, then you have been hit by the epoll bug. Now, you have to create a new selector, register all the existing selectionKey on the new selector, and substitute the old selector with the new one. Yukkkk. But it works.

http://github.com/ok2c/lightnio

This code is what I would like to get potentially replaced by MINA 3.0

Let's work on that.

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

Reply via email to