jsr369-experts@servlet-spec.java.net

[jsr369-experts] Re: [servlet-spec users] Re: Re: Re: Clarify onAllDataRead ?

From: Greg Wilkins <gregw_at_intalio.com>
Date: Thu, 5 Feb 2015 09:35:28 +1100

On 4 February 2015 at 20:21, Mark Thomas <markt_at_apache.org> wrote:

> I'm leaning towards "no".


I'm leaning with you!


So as I'm still having a fair bit of user confusion - I thought I might
just list the behaviour clarifications that I think have been generally
agreed in this thread - and if I have them right, I will then propose some
javadoc etc. to make it clearer in the code:

   - onAllDataRead will always be called once and only once when EOF stream
   is reached in the input stream (with the exception for completion - see
   below).
   - The call to onAllDataRead will NOT be concurrent with any other
   callbacks associated with the stream (onDataAvailable, onWritePossible,
   service etc.). onAllDataRead will only be called once the prior callback
   returns.
   - It is possible for -1 to be read from a stream during such a callback
   to onDataAvailable.
   - It is possible for onAllDataRead to be called directly without -1
   being read during a call to onDataAvailable.
   - If isReady() returns false, then a callback to onDataAvailable() will
   be scheduled for when a read can proceed.
   - If the stream is at EOF, then isReady() will return true as -1 can be
   read.
   - isFinished() will return false until such time as EOF has been
   communicated to the application ether by reading -1 or by calling
   onDataAvailable()
   - If the AsyncContext.complete() method is called, or a Servlet.service
   ASYNC dispatch returns without another startAsync, then the
   request/response lifecycle is completed and no further callbacks
   (onDataAvailable, onAllDataRead, onWritePossible, service, filter) will be
   dispatched for that request/response.

If none of these are objectionable, then I'll try to write them up better
in terms of javadoc modification proposals.

cheers


-- 
Greg Wilkins <gregw_at_intalio.com>  @  Webtide - *an Intalio subsidiary*
http://eclipse.org/jetty HTTP, SPDY, Websocket server and client that scales
http://www.webtide.com  advice and support for jetty and cometd.