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

Daniel Fuchs dfuchs at openjdk.org
Tue Jun 13 15:48:56 UTC 2023


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.

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

Commit messages:
 - 8309939

Changes: https://git.openjdk.org/jdk/pull/14450/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14450&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8309939
  Stats: 162 lines in 6 files changed: 146 ins; 0 del; 16 mod
  Patch: https://git.openjdk.org/jdk/pull/14450.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14450/head:pull/14450

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


More information about the net-dev mailing list