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:19:01 UTC 2023
On Fri, 16 Jun 2023 14:39:03 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> 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.
We can also avoid using that method. I guess we can always deal with it later if it proves to be a problem.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1232450331
More information about the net-dev
mailing list