Murtadha Hubail has submitted this change and it was merged.

Change subject: [NO ISSUE][OTH] Catch All Interrupts on Request Cancellation
......................................................................


[NO ISSUE][OTH] Catch All Interrupts on Request Cancellation

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- Catch all exceptions that could be caused by an interrupt
  during request cancellation.

Change-Id: Ib2595ce8a80d8df324e5d97591639d3f9efe1b9d
Reviewed-on: https://asterix-gerrit.ics.uci.edu/3250
Sonar-Qube: Jenkins <[email protected]>
Integration-Tests: Jenkins <[email protected]>
Tested-by: Jenkins <[email protected]>
Contrib: Jenkins <[email protected]>
Reviewed-by: Michael Blow <[email protected]>
---
M 
asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
1 file changed, 7 insertions(+), 3 deletions(-)

Approvals:
  Anon. E. Moose #1000171: 
  Jenkins: Verified; No violations found; ; Verified
  Michael Blow: Looks good to me, approved



diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
index c49fcdd..0996c6c 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
@@ -66,6 +66,7 @@
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.common.exceptions.CompilationException;
 import org.apache.asterix.common.exceptions.ErrorCode;
+import org.apache.asterix.common.exceptions.ExceptionUtils;
 import org.apache.asterix.common.exceptions.MetadataException;
 import org.apache.asterix.common.exceptions.RuntimeDataException;
 import org.apache.asterix.common.functions.FunctionSignature;
@@ -2624,9 +2625,12 @@
                 hcc.waitForCompletion(jobId);
                 printer.print(jobId);
             }
-        } catch (InterruptedException e) {
-            Thread.currentThread().interrupt();
-            throw new RuntimeDataException(ErrorCode.REQUEST_CANCELLED, 
clientRequest.getId());
+        } catch (Exception e) {
+            if (ExceptionUtils.getRootCause(e) instanceof 
InterruptedException) {
+                Thread.currentThread().interrupt();
+                throw new RuntimeDataException(ErrorCode.REQUEST_CANCELLED, 
clientRequest.getId());
+            }
+            throw e;
         } finally {
             // complete async jobs after their job completes
             if (ResultDelivery.ASYNC == resultDelivery) {

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/3250
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib2595ce8a80d8df324e5d97591639d3f9efe1b9d
Gerrit-PatchSet: 3
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Murtadha Hubail <[email protected]>
Gerrit-Reviewer: Ali Alsuliman <[email protected]>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-Reviewer: Michael Blow <[email protected]>
Gerrit-Reviewer: Murtadha Hubail <[email protected]>
Gerrit-Reviewer: Till Westmann <[email protected]>

Reply via email to