asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mb...@apache.org
Subject asterixdb git commit: [NO ISSUE][HYR] Don't suppress errors, check interrupted exceptions
Date Tue, 24 Oct 2017 16:13:15 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master b0f40dba4 -> 5e39b4c1f


[NO ISSUE][HYR] Don't suppress errors, check interrupted exceptions

Avoid suppressing instances of Error into a HyracksDataException,
instead rethrow it.  Check when suppressing an InterruptedException that
the calling thread is itself interrupted, otherwise emit a warning

Change-Id: I9784a18aaaed93e16078437b1cff5006e2a33861
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2095
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/5e39b4c1
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/5e39b4c1
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/5e39b4c1

Branch: refs/heads/master
Commit: 5e39b4c1f15db7c9d34a0226f8297e3984584c72
Parents: b0f40db
Author: Michael Blow <michael.blow@couchbase.com>
Authored: Mon Oct 23 22:45:26 2017 -0400
Committer: Michael Blow <mblow@apache.org>
Committed: Tue Oct 24 09:12:50 2017 -0700

----------------------------------------------------------------------
 .../hyracks/api/exceptions/HyracksDataException.java      | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5e39b4c1/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksDataException.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksDataException.java
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksDataException.java
index 2cf804e..4517730 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksDataException.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksDataException.java
@@ -40,6 +40,7 @@ public class HyracksDataException extends HyracksException {
             // don't wrap errors, allow them to propagate
             throw (Error)cause;
         } else if (cause instanceof InterruptedException && !Thread.currentThread().isInterrupted())
{
+            // TODO(mblow): why not force interrupt on current thread?
             LOGGER.log(Level.WARNING,
                     "Wrapping an InterruptedException in HyracksDataException and current
thread is not interrupted",
                     cause);
@@ -59,6 +60,15 @@ public class HyracksDataException extends HyracksException {
         if (root == null) {
             return HyracksDataException.create(th);
         }
+        if (th instanceof Error) {
+            // don't suppress errors into a HyracksDataException, allow them to propagate
+            th.addSuppressed(root);
+            throw (Error) th;
+        } else if (th instanceof InterruptedException && !Thread.currentThread().isInterrupted())
{
+            // TODO(mblow): why not force interrupt on current thread?
+            LOGGER.log(Level.WARNING, "Suppressing an InterruptedException in a HyracksDataException
and current "
+                    + "thread is not interrupted", th);
+        }
         root.addSuppressed(th);
         return root;
     }


Mime
View raw message