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

Daniel Fuchs dfuchs at openjdk.org
Fri Jun 16 14:42:03 UTC 2023


On Fri, 16 Jun 2023 12:46:35 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

>> 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().

I can modify the toString to be 

  return "Deadline(" + deadline.toString() + ")";

if you think it's better.

But I do believe that using a fake instant for the origin of the NanoSource would be way more confusing.

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

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


More information about the net-dev mailing list