On 01/15/2013 11:31 AM, Mark Thomas wrote:
> While working on the WebSocket implementation (that requires some writes
> to be blocking and some non-blocking) I was thinking about the expected
> behaviour of flush().
>
> If I have a ServletOutputStream that is in non-blocking mode and
> isReady() currently returns false (i.e. there was a previous write that
> has not been fully written yet) does a call to flush() block until all
> that data has been written?
>
> My reading of the Javadoc is that flush() will block in these
> circumstances. If this is correct, it might be useful to add this
> clarification to the Javadoc. If this is wrong, then some clarification
> is certainly called for.
If I remember correctly, "smart" blocking was not included, so I don't
think flush() is supposed to be blocking. So if isReady() has just
returned false, then it would mean you should wait for the write
listener call to do the flush().
Rémy