On Wed, 14 Jun 2023 12:12:37 GMT, Daniel Jeliński <[email protected]> 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