Hi all, I'm trying to use the httpcore NIO extensions to implement a large-scale non-blocking http client. I've done this by implementing the HttpRequestExecutionHandler interface, and my code is largely based off the sample client at http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java .
I asked a similar question to this mailing list a while back -- I had a difficult time trying to figure out which methods to hook into to ensure that I'll always respond to completed HTTP requests -- whether they succeed or fail in any number of ways (timeout, errors, etc). I found the documentation lacking at the time, and I see that it's been much improved since then, but it's still not clear to me which method (or set of methods?) will give me the behavior I'm looking for. My current solution for this is to implement connectionClosed method in the EventListener interface, and the cancelled, failed, and timeout methods in the SessionRequestCallback interface -- but it seems like every once in a while, one of my requests is returned (as an attachment) through more than one of these methods. Is the finalizeContext method of the HttpRequestExecutionHandler interface always called when a request is done, even if the request failed in any way? If not, how many other methods (in SessionRequestCallback and/or EventListener) do I have to implement, and which set will be called once (and only once) at the final stage of handling for a request? Thanks, Chas
