RFR: 8309939: HttpClient should not use Instant.now() as Instant source for deadlines [v2]
Daniel Fuchs
dfuchs at openjdk.org
Wed Jun 14 12:44:31 UTC 2023
On Wed, 14 Jun 2023 12:12:37 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:
>> Daniel Fuchs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
>>
>> - Merge branch 'master' into TimeSource
>> - 8309939
>
> src/java.net.http/share/classes/jdk/internal/net/http/common/TimeSource.java line 41:
>
>> 39: * of monotonicity than the {@link System#nanoTime()} it is based on.
>> 40: */
>> 41: public final class TimeSource implements InstantSource {
>
> Given that all instances of TimeSource are essentially the same (through the use of shared `nanoSource`), can we add a private constructor and make this class a singleton?
Good point. That's an oversight.
> src/java.net.http/share/classes/jdk/internal/net/http/common/TimeSource.java line 46:
>
>> 44: private static final TimeSource SOURCE = new TimeSource();
>> 45:
>> 46: private static final class NanoSource implements InstantSource {
>
> This class doesn't need to implement InstantSource
Good point
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1229547997
PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1229547152
More information about the net-dev
mailing list