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

Daniel Jeliński djelinski at openjdk.org
Fri Jun 16 16:27:08 UTC 2023


On Wed, 14 Jun 2023 15:39:10 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.
>
> Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Use Deadline rather than Instant

Using nanoTime as @RogerRiggs suggested is worth exploring, but IMO the current version is good enough for internal use.

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

Marked as reviewed by djelinski (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/14450#pullrequestreview-1483896129


More information about the net-dev mailing list