You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by av...@apache.org on 2018/07/17 21:46:10 UTC
[19/28] ignite git commit: IGNITE-8992 Wrong log when
LongJVMPauseDetector stops the worker thread
IGNITE-8992 Wrong log when LongJVMPauseDetector stops the worker thread
Signed-off-by: Anton Vinogradov <av...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9e4c2cdf
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9e4c2cdf
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9e4c2cdf
Branch: refs/heads/ignite-8783
Commit: 9e4c2cdf8008cc7bb31d5fe36c4d28dd175afe89
Parents: 8d1b1d6
Author: Garus Denis <ga...@gmail.com>
Authored: Tue Jul 17 12:48:08 2018 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Tue Jul 17 12:48:54 2018 +0300
----------------------------------------------------------------------
.../ignite/internal/LongJVMPauseDetector.java | 6 ++++--
.../ignite/internal/LongJVMPauseDetectorTest.java | 18 ++++++++++++++++++
2 files changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9e4c2cdf/modules/core/src/main/java/org/apache/ignite/internal/LongJVMPauseDetector.java
----------------------------------------------------------------------
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 8df04f9..08b118e 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
@@ -21,7 +21,6 @@ import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.logger.java.JavaLogger;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_JVM_PAUSE_DETECTOR_DISABLED;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_JVM_PAUSE_DETECTOR_LAST_EVENTS_COUNT;
@@ -118,7 +117,10 @@ class LongJVMPauseDetector {
}
}
catch (InterruptedException e) {
- log.error(getName() + " has been interrupted", e);
+ if (workerRef.compareAndSet(this, null))
+ log.error(getName() + " has been interrupted.", e);
+ else if (log.isDebugEnabled())
+ log.debug(getName() + " has been stopped.");
break;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9e4c2cdf/modules/core/src/test/java/org/apache/ignite/internal/LongJVMPauseDetectorTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/LongJVMPauseDetectorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/LongJVMPauseDetectorTest.java
index 80761d1..267f389 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/LongJVMPauseDetectorTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/LongJVMPauseDetectorTest.java
@@ -55,4 +55,22 @@ public class LongJVMPauseDetectorTest extends GridCommonAbstractTest {
assertTrue(strLog.toString().contains("LongJVMPauseDetector was successfully started"));
}
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStopWorkerThread() throws Exception {
+ strLog = new GridStringLogger(true);
+
+ strLog.logLength(300_000);
+
+ startGrid(0);
+
+ stopGrid(0);
+
+ String log = strLog.toString();
+
+ assertFalse(log.contains("jvm-pause-detector-worker has been interrupted."));
+ assertTrue(log.contains("jvm-pause-detector-worker has been stopped."));
+ }
}