jsr340-experts@servlet-spec.java.net

[jsr340-experts] NIO writes and flush()

From: Mark Thomas <markt_at_apache.org>
Date: Tue, 15 Jan 2013 10:31:39 +0000

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.

Mark