RFR: 8267262: com/sun/net/httpserver/Filter improve API documentation of static methods

Chris Hegarty chegar at openjdk.java.net
Wed May 19 09:10:53 UTC 2021

On Tue, 18 May 2021 09:49:26 GMT, Daniel Fuchs <dfuchs at openjdk.org> 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

More information about the net-dev mailing list