jsr340-experts@servlet-spec.java.net

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

From: Rajiv Mordani <rajiv.mordani_at_oracle.com>
Date: Wed, 28 Nov 2012 15:40:09 -0800

On 11/27/12 2:48 AM, Rémy Maucherat wrote:
> 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 ?


Yes today in the spec we say it is illegal but don't say that an ISE
should be thrown. We should say that it is illegal and that the
container must throw an ISE.

- Rajiv

>
> 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
>