On Wed, 19 May 2021 08:41:08 GMT, Peter Levart <plev...@openjdk.org> wrote:
>> 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. > > I see the localOffset passed to VM.getNanoTimeAdjustment() has to be in the > range of current time +/- 2^32 seconds. This means the thread would have to > sleep for ~136 years before the exception is triggered. I think this is more > than enough. :-) Exactly. You could hit the 1ns if the operating system clock was concurrently moved backward by a NTP adjustment of ~ 1024 seconds at the same time that the offset is taken but this would be extremely unlikely - I don't believe it deserves any infinite retry loop. That was discussed at the time the enhancement that provides sub-millisecond precision was proposed, and it was rejected in favor of a one time retry. ------------- PR: https://git.openjdk.java.net/jdk/pull/4016