[concurrency-interest] Sleep time consistency compared to System.currentTimeMillis
tg at freigmbh.de
Fri Aug 24 05:10:20 EDT 2018
There are multiple Classes that let you wait or sleep for a specified
amount of time. My current understanding is:
Thread.sleep and Object.wait can wake up earlier than specified so code
that also uses System.currentTimeMillies can break because wakeups
happen to early.
On the other side code that uses higher level Abstraction such as
ScheduledExecutorService or CountDownLatch.await will always at least
wait for the specified time and it will be consistent with
System.currentTimeMillies. Is that actually correct and guaranteed or is
is just implementation dependent?
More information about the Concurrency-interest