On Mon, 6 Jul 2026 17:33:30 GMT, Benjamin Peterson <[email protected]> wrote:
>> Make `MinimalFuture` cancelation atomic. This prevents HTTP request >> cancelation logic from racily completing the future with an error. >> >> >> >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > Benjamin Peterson has updated the pull request with a new target base due to > a merge or a rebase. The incremental webrev excludes the unrelated changes > brought in by the merge/rebase. The pull request contains five additional > commits since the last revision: > > - sharpen testPostSendAsync assertion like testGetSendAsync > - add assert isDone > - add testCancel > - Merge branch 'master' into httpclient-cancel-race > - 8380967: Canceled HttpClient.sendAsync futures throw inconsistent > exceptions > > Make `MinimalFuture` cancelation atomic. This prevents HTTP request > cancelation logic from racily completing the future with an error. Thanks for taking on the feedback! test/jdk/java/net/httpclient/CancelRequestTest.java line 401: > 399: } catch (CancellationException x) { > 400: out.println(now() + "Got expected exception: " + x); > 401: } Hmmm... Wouldn't it be better and clearer if we used `assertThrows(CancellationException.class, cf1::get)` here (and below in POST too)? What do you think? ------------- PR Review: https://git.openjdk.org/jdk/pull/31758#pullrequestreview-4645970011 PR Review Comment: https://git.openjdk.org/jdk/pull/31758#discussion_r3537151279
