JDK-8252515 : Release Note: The Default HttpClient Implementation Returns Cancelable Futures
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 16
  • Priority: P3
  • Status: Closed
  • Resolution: Delivered
  • Submitted: 2020-08-28
  • Updated: 2021-12-02
  • Resolved: 2020-09-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 16
16Resolved
Description
In this release, the default `HttpClient` returns *cancelable* futures.

The default `HttpClient` is created by a call to `HttpClient.newHttpClient()`, or by invoking the `build` method on builders returned by `HttpClient.newBuilder()`.
The implementation of the `sendAsync` methods in the default `HttpClient` now return `CompletableFuture` objects that are *cancelable*.
Invoking `cancel(true)` on a *cancelable* future that is not completed, attempts to cancel the HTTP exchange in an effort to release underlying resources as soon as possible. More information can be obtained by reading the API documentation of the `HttpClient::sendAsync` methods.
Comments
[~chegar] Thanks for the edits. They look fine!
10-09-2020

[~dfuchs] I made some minor edits. Please revert if you disagree.
09-09-2020