You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dp...@apache.org on 2024/02/09 19:38:02 UTC

(ignite) branch master updated: IGNITE-21475 Replacing currentTimeMillis with nanoTime in LongJVMPauseDetector (#11239)

This is an automated email from the ASF dual-hosted git repository.

dpavlov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 61682fcf897 IGNITE-21475 Replacing currentTimeMillis with nanoTime in LongJVMPauseDetector (#11239)
61682fcf897 is described below

commit 61682fcf897e8b55507f7cfa0da71cc2fcd36308
Author: oleg-vlsk <15...@users.noreply.github.com>
AuthorDate: Sat Feb 10 05:37:52 2024 +1000

    IGNITE-21475 Replacing currentTimeMillis with nanoTime in LongJVMPauseDetector (#11239)
---
 .../main/java/org/apache/ignite/internal/LongJVMPauseDetector.java   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/core/src/main/java/org/apache/ignite/internal/LongJVMPauseDetector.java b/modules/core/src/main/java/org/apache/ignite/internal/LongJVMPauseDetector.java
index 1d5ce72a50d..e640ea8c3f9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/LongJVMPauseDetector.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/LongJVMPauseDetector.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal;
 
 import java.util.Map;
 import java.util.TreeMap;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.IgniteSystemProperties;
@@ -113,7 +114,7 @@ public class LongJVMPauseDetector {
 
             @Override public void run() {
                 synchronized (LongJVMPauseDetector.this) {
-                    lastWakeUpTime = System.currentTimeMillis();
+                    lastWakeUpTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
                 }
 
                 if (log.isDebugEnabled())
@@ -123,7 +124,7 @@ public class LongJVMPauseDetector {
                     try {
                         Thread.sleep(PRECISION);
 
-                        final long now = System.currentTimeMillis();
+                        final long now = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
                         final long pause = now - PRECISION - lastWakeUpTime;
 
                         if (pause >= THRESHOLD) {