On Wed, 14 Jun 2023 15:39:10 GMT, Daniel Fuchs <[email protected]> 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

src/java.net.http/share/classes/jdk/internal/net/http/common/Deadline.java line 
203:

> 201:     @Override
> 202:     public String toString() {
> 203:         return deadline.toString();

I'm not sure about using `Instant.toString` here; if we ever log a `Deadline` 
instance along with the current time and the clock skews, we will need to read 
the code along with the logs to figure out which date represents a deadline and 
which one represents an instant.
I guess the problem would also go away if we initialized the first NanoSource 
with something other than Instant.now().

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

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

Reply via email to