Integrated: 8309939: HttpClient should not use Instant.now() as Instant source for deadlines

Daniel Fuchs dfuchs at openjdk.org
Mon Jun 19 13:29:25 UTC 2023


On Tue, 13 Jun 2023 15:40:34 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

> The HttpClient uses `Instant.now()` to create deadlines for timeouts. This could have undesirable effects since `Instant.now()` is linked to the wall clock, which is not monotonic. This fix changes the HttpClient to use a monotonic instant source based on `System.nanoTime()` for the purpose of setting and comparing deadlines.

This pull request has now been integrated.

Changeset: f8f8bfbe
Author:    Daniel Fuchs <dfuchs at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/f8f8bfbea15de0a57415ba27ad5722b6a4add07a
Stats:     442 lines in 8 files changed: 412 ins; 2 del; 28 mod

8309939: HttpClient should not use Instant.now() as Instant source for deadlines

Reviewed-by: djelinski

-------------

PR: https://git.openjdk.org/jdk/pull/14450


More information about the net-dev mailing list