RFR: 8299015: Ensure that HttpResponse.BodySubscribers.ofFile writes all bytes

Dawid Weiss dawid.weiss at gmail.com
Tue Dec 20 10:20:50 UTC 2022


> I would expect that 0 can only be returned if the channel is configured non blocking. So maybe for our piece of mind we could throw an IOException if that happens, which would then be caught below and cause close() and subscription.cancel() to be called, and the result to be completed exceptionally?

Why can't it just spin-wait and let the IO subsystem handle buffer
writes, whenever they're possible? I'd find an exception from that method
surprising - even if the filesystem returns zero written bytes, for
whatever reason, I don't think it's an exceptional situation - it
follows the contract of that method and is a valid output to me;
handle it like any other bytesWritten > 0?



Dawid


More information about the net-dev mailing list