jsr340-experts@servlet-spec.java.net

[jsr340-experts] Re: NIO writes and flush()

From: Mark Thomas <markt_at_apache.org>
Date: Tue, 15 Jan 2013 12:09:38 +0000

On 15/01/2013 11:01, Rémy Maucherat wrote:
> On 01/15/2013 11:53 AM, Mark Thomas wrote:
>> So if isReady() has just
>> returned false, then it would mean you should wait for the write
>> listener call to do the flush().
>> But what would be the point of calling flush() at that point?
> I think some data will still be in the buffer in the Servlet layer. I
> haven't read that it would be automatically flushed before calling the
> write listener (it probably shouldn't be, it would likely make IO less
> efficient by causing extra writes).

That makes sense. I've been focussed on using this in HTTP upgrade so I
haven't been thinking about the other use cases.

>> And if you don't wait should an ISE be thrown if flush() is called?
> Yes, doing the same thing as for a write could be logical.

Agreed.

Marl