cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcken...@apache.org
Subject [03/10] cassandra git commit: Inspect cause and suppressed exceptions in JVMStabilityInspector
Date Tue, 29 Sep 2015 16:16:37 GMT
Inspect cause and suppressed exceptions in JVMStabilityInspector

Patch by Paul Macintosh; reviewed by aweisberg for CASSANDRA-10228


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/39ab9e05
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/39ab9e05
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/39ab9e05

Branch: refs/heads/cassandra-3.0
Commit: 39ab9e05248ab346482f34c875cff6b9b9b6cad5
Parents: 6039d0e
Author: Paul Macintosh <pm@goretechs.com>
Authored: Tue Sep 29 12:11:32 2015 -0400
Committer: Joshua McKenzie <jmckenzie@apache.org>
Committed: Tue Sep 29 12:11:32 2015 -0400

----------------------------------------------------------------------
 .../org/apache/cassandra/utils/JVMStabilityInspector.java   | 4 ++++
 .../apache/cassandra/utils/JVMStabilityInspectorTest.java   | 9 +++++++++
 2 files changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/39ab9e05/src/java/org/apache/cassandra/utils/JVMStabilityInspector.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/JVMStabilityInspector.java b/src/java/org/apache/cassandra/utils/JVMStabilityInspector.java
index de396bb..2884bc2 100644
--- a/src/java/org/apache/cassandra/utils/JVMStabilityInspector.java
+++ b/src/java/org/apache/cassandra/utils/JVMStabilityInspector.java
@@ -45,6 +45,7 @@ public final class JVMStabilityInspector
 
     /**
      * Certain Throwables and Exceptions represent "Die" conditions for the server.
+     * This recursively checks the input Throwable's cause hierarchy until null.
      * @param t
      *      The Throwable to check for server-stop conditions
      */
@@ -65,6 +66,9 @@ public final class JVMStabilityInspector
 
         if (isUnstable)
             killer.killCurrentJVM(t);
+
+        if (t.getCause() != null)
+            inspectThrowable(t.getCause());
     }
 
     public static void inspectCommitLogThrowable(Throwable t)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/39ab9e05/test/unit/org/apache/cassandra/utils/JVMStabilityInspectorTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/utils/JVMStabilityInspectorTest.java b/test/unit/org/apache/cassandra/utils/JVMStabilityInspectorTest.java
index ff8188f..59a7e48 100644
--- a/test/unit/org/apache/cassandra/utils/JVMStabilityInspectorTest.java
+++ b/test/unit/org/apache/cassandra/utils/JVMStabilityInspectorTest.java
@@ -63,6 +63,15 @@ public class JVMStabilityInspectorTest
             killerForTests.reset();
             JVMStabilityInspector.inspectCommitLogThrowable(new Throwable());
             assertTrue(killerForTests.wasKilled());
+
+            killerForTests.reset();
+            JVMStabilityInspector.inspectThrowable(new Exception(new IOException()));
+            assertFalse(killerForTests.wasKilled());
+
+            killerForTests.reset();
+            JVMStabilityInspector.inspectThrowable(new Exception(new OutOfMemoryError()));
+            assertTrue(killerForTests.wasKilled());
+
         }
         finally
         {


Mime
View raw message