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

Reply via email to