----- Original Message -----
> From: "Shing Wai Chan" <shing.wai.chan_at_oracle.com>
> To: users_at_servlet-spec.java.net
> Sent: Friday, November 30, 2012 6:11:45 PM
> Subject: [servlet-spec users] Re: Relationship between the non-blocking API and Servlet 3.0 async processing
>
> NonBlocking IO is different from Async IO here.
Could you be more specific? Servlet 3 async processing provides a mechanism for releasing the initial thread and allowing subsequent threads to continue processing along with the ability dispatch, handle timeouts, complete the request, etc. Is that not the expected threading model for the non-blocking IO? In other words are you suggesting the initial thread should block?
> In our JavaOne presentation, we do try to put Async and Non Blocking
> IO together.
> You can take a look at Example 3 of the Non-blocking IO in the
> presentation below
> https://blogs.oracle.com/swchan/entry/javaone_2012_what_s_new
From what I can see in examples 1 and 2, the initial servlet thread does block. That may be non-blocking IO but it is blocking the servlet thread.
I don't understand example 3. It looks like you call startAsync and then asyncContext.complete() both in ReadTestServlet2 and in ReadListenerImpl. What about writing? And where will the code be to complete processing (e.g. JSP rendering), in ReadTestServlet2 or in ReaderListenerImpl? If processing completes in ReadTestServlet2, any filters on the call stack won't be able to do anything since complete() has already been called.
Rossen