RFR: 8266846: Add java.time.InstantSource [v3]

Stephen Colebourne scolebourne at openjdk.java.net
Tue May 18 23:18:43 UTC 2021


On Sun, 16 May 2021 07:39:21 GMT, Peter Levart <plevart at openjdk.org> wrote:

>> Stephen Colebourne has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8266846: Add java.time.InstantSource
>
> src/java.base/share/classes/java/time/Clock.java line 487:
> 
>> 485:             // it more unlikely to hit the 1ns in the future condition.
>> 486:             localOffset = System.currentTimeMillis()/1000 - 1024;
>> 487: 
> 
> Is it possible that after a fresh localOffset is retrieved, the thread is preempted and when it is scheduled again after a pause, the getNanoTimeAdjustment below returns -1 ? Would it help if instead of throwing exception, there was an infinite retry loop?

This isn't my logic - it is existing code that has been moved. I'm not a fan of infinite retry loops as the can hang the system. But I'm happy to change it to work that way if there is a consensus to do so.

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

PR: https://git.openjdk.java.net/jdk/pull/4016


More information about the core-libs-dev mailing list