On Tue, 18 May 2021 09:49:26 GMT, Daniel Fuchs <[email protected]> wrote:
>> The filter operation `Consumer` that is passed to the factory methods can
>> throw an unchecked exception. This change adds a note on the exception
>> handling in that case. It also adds a clarification to
>> `Filter::afterHandler` on the relation of the filter operation and the
>> client receiving the response.
>
> src/jdk.httpserver/share/classes/com/sun/net/httpserver/Filter.java line 213:
>
>> 211: * Doing so is likely to fail, since the exchange has commonly been
>> handled
>> 212: * before the {@code operation} is invoked. Correspondingly, the
>> client
>> 213: * commonly receives the response before the filter operation is
>> executed.
>
> I'd rather replace `commonly` with `may`: this is essentially racy and you
> cannot assume that any of the outcome is more likely than the other.
>
>
> * [...] Correspondingly, the client
> * may receive the response before the filter operation is executed.
Maybe rephrase? Who knows what the client will received, if anything - since
the bytes will be sent over the network.
Maybe something like:
More specifically, the response will typically be sent before the filter
operation is executed.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4085