jsr340-experts@servlet-spec.java.net

[jsr340-experts] Re: Servlet 3.1 EDR comments for Http Upgrade

From: Rémy Maucherat <rmaucher_at_redhat.com>
Date: Tue, 27 Nov 2012 11:48:38 +0100

On 11/27/2012 01:22 AM, Shing Wai Chan wrote:
> ServletInputStream
>> - Given it is illegal to call read() when !isReady(), what happens if
>> one does call read()? IllegalStateException?
> If isReady() is, in fact, false, then read() will be blocking rather
> than throwing ISE in this case.
>> ServletOutputStream
>> - Given it is illegal to call write() when !canWrite(), what happens if
>> one does call write()? IllegalStateException?
> If canWrite() is, in fact, false, then write() will be blocking rather
> than throwing ISE in this case.
That's a pretty large change in behavior from the "illegal" that is
mentioned in the draft right now. I thought there was no agreement about
having "smart" blocking. Or does this only happen if there's no
corresponding read/write listener set ?

There should be an exception to that though: asynchronous writes (made
from outside of a container thread) normally cannot become blocking
since it could then mean concurrent operations (and a crash for the
native implementation I use), and should be a programming error anyway.

Rémy