Addition to my previous message: 1. IgniteUtils#currentTimeMillis used in current master to check transaction timeout:
https://github.com/apache/ignite/blob/master/modules/ core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/ IgniteTxAdapter.java#L664 2. According to jdk docs System.nanoTime() is only method to measure elapsed time https://docs.oracle.com/javase/7/docs/api/java/lang/System.html#nanoTime(). "This method can only be used to measure elapsed time and is not related to any other notion of system or wall-clock time" What are reasons to use System.currentTimeMillis() in the way it used for now? 2017-08-07 18:42 GMT+03:00 Николай Ижиков <nizhikov....@gmail.com>: > Hello, Igniters. > > I found unusual implementation of IgniteUtils#currentTimeMillis function. > Method is not simple proxy to System.currentTimeMillis > Instead it read static variable which updated by dedicated thread: > > https://github.com/apache/ignite/blob/master/modules/ > core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java#L3251 > > while (true) { > curTimeMillis = System.currentTimeMillis(); > > try { > Thread.sleep(10); > } > catch (InterruptedException ignored) { > break; > } > } > > As far as i know `Thread.sleep` is unprecise function especially under > heavy load and on small timeout values like 10 ms. > Seems that we get very unprecise values of currentTimeMillis. > > I think that can lead to difficult bugs like https://issues.apache. > org/jira/browse/IGNITE-5963 > > What is purpose of current implementation? > > -- > Nikolay Izhikov > nizhikov....@gmail.com > -- Nikolay Izhikov nizhikov....@gmail.com