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

Daniel Fuchs dfuchs at openjdk.org
Wed Jun 14 17:34:56 UTC 2023


On Wed, 14 Jun 2023 17:29:06 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> OK. Here is a version that uses a new class "Deadline" instead of "Instant".
>
> Wrapping the Instant is safe/fine.
> However, it could quite a bit simpler (it seems) to just use the raw `long` nanoTime values.
> Though milliseconds or seconds would be sufficient for the timeouts.
> The complexity of the volatile read and needing to reset the nanoSource could be avoided.

Working with Instant (now Deadline) and  Duration is much safer and easier than working with longs representing nano time, especially when you have a sorted list of deadlines.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1229955654


More information about the net-dev mailing list