merge branch gerrit/trinity into gerrit/ionic

Ext-ref: MB-65953
Change-Id: Ic7e9d34005c648d6b8cf5fb9cbc1ad14ed32bfee
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java
index 755d4f6..3948e2f 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java
@@ -112,7 +112,7 @@
             try {
                 clusterStateManager.waitForState(ClusterState.ACTIVE, maxWaitCycles, TimeUnit.SECONDS);
             } catch (HyracksDataException e) {
-                throw new AlgebricksException(e, TIMEOUT);
+                throw new AlgebricksException(TIMEOUT, e);
             } catch (InterruptedException e) {
                 if (LOGGER.isWarnEnabled()) {
                     LOGGER.warn("Thread interrupted while waiting for cluster to be " + ClusterState.ACTIVE);
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 069e99c..fee660d 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
@@ -5631,7 +5631,7 @@
             if (atomic && jobId != null) {
                 globalTxManager.abortTransaction(jobId);
             }
-            if (ExceptionUtils.getRootCause(e) instanceof InterruptedException) {
+            if (ExceptionUtils.causedByInterrupt(e)) {
                 Thread.currentThread().interrupt();
                 throw new RuntimeDataException(ErrorCode.REQUEST_CANCELLED, clientRequest.getId());
             }
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java
index 93f513d..c7bf3b4 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java
@@ -35,8 +35,10 @@
 import org.apache.asterix.file.StorageComponentProvider;
 import org.apache.asterix.test.base.AsterixTestHelper;
 import org.apache.asterix.test.common.TestExecutor;
+import org.junit.Ignore;
 import org.junit.Test;
 
+@Ignore("Is this test still needed? And why hasn't it failed before? It is looking for some load-cust.aql script")
 public class DmlTest {
 
     private static final String[] ASTERIX_DATA_DIRS = new String[] { "nc1data", "nc2data" };
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/TPCExecutionTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/TPCExecutionTest.java
index f777bd5..fe94fed 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/TPCExecutionTest.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/TPCExecutionTest.java
@@ -30,6 +30,7 @@
 import org.apache.hyracks.control.nc.NodeControllerService;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -39,6 +40,7 @@
  * Runs the Transaction Processing Council (TPC) runtime tests with the storage parallelism.
  */
 
+@Ignore("Only tests data generation function for tpcds, causes intermittent failures")
 @RunWith(Parameterized.class)
 public class TPCExecutionTest {
     protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc.conf";
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/OptimizationConfUtil.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/OptimizationConfUtil.java
index c866d22..6de87a9 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/OptimizationConfUtil.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/OptimizationConfUtil.java
@@ -150,7 +150,7 @@
             return externalScanMemorySizeParameter != null ? intByteParser.parse(externalScanMemorySizeParameter)
                     : compilerExternalScanMemorySize;
         } catch (IllegalArgumentException e) {
-            throw AsterixException.create(ErrorCode.COMPILATION_ERROR, sourceLoc, e.getMessage());
+            throw AsterixException.create(ErrorCode.COMPILATION_ERROR, e, sourceLoc, e.getMessage());
         }
     }
 
@@ -186,7 +186,7 @@
         try {
             memBudget = parameter == null ? memBudgetInConfiguration : longBytePropertyInterpreter.parse(parameter);
         } catch (IllegalArgumentException e) {
-            throw AsterixException.create(ErrorCode.COMPILATION_ERROR, sourceLoc, e.getMessage());
+            throw AsterixException.create(ErrorCode.COMPILATION_ERROR, e, sourceLoc, e.getMessage());
         }
         int frameLimit = (int) (memBudget / frameSize);
         if (frameLimit < minFrameLimit) {
@@ -205,7 +205,7 @@
             return valueInQuery == null ? compilerProperties.getSortSamples()
                     : OptionTypes.POSITIVE_INTEGER.parse(valueInQuery);
         } catch (IllegalArgumentException e) {
-            throw AsterixException.create(ErrorCode.COMPILATION_BAD_QUERY_PARAMETER_VALUE, sourceLoc,
+            throw AsterixException.create(ErrorCode.COMPILATION_BAD_QUERY_PARAMETER_VALUE, e, sourceLoc,
                     CompilerProperties.COMPILER_SORT_SAMPLES_KEY, 1, "samples");
         }
     }
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/AsterixException.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/AsterixException.java
index 92714b3..8421ee2 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/AsterixException.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/AsterixException.java
@@ -26,20 +26,37 @@
 public class AsterixException extends AlgebricksException {
     private static final long serialVersionUID = 1L;
 
-    public AsterixException(ErrorCode error, Throwable cause, SourceLocation sourceLoc, Serializable... params) {
-        super(error, cause, sourceLoc, params);
+    public static AsterixException create(ErrorCode error, Serializable... params) {
+        return new AsterixException(error, params);
+    }
+
+    public static AsterixException create(ErrorCode error, Throwable th, Serializable... params) {
+        return new AsterixException(error, th, params);
+    }
+
+    public static AsterixException create(ErrorCode error, SourceLocation sourceLoc, Serializable... params) {
+        return new AsterixException(error, sourceLoc, params);
+    }
+
+    public static AsterixException create(ErrorCode error, Throwable th, SourceLocation sourceLoc,
+            Serializable... params) {
+        return new AsterixException(error, th, sourceLoc, params);
+    }
+
+    public AsterixException(ErrorCode error, Serializable... params) {
+        this(error, null, null, params);
+    }
+
+    public AsterixException(ErrorCode error, Throwable cause, Serializable... params) {
+        this(error, cause, null, params);
     }
 
     public AsterixException(ErrorCode error, SourceLocation sourceLoc, Serializable... params) {
         this(error, null, sourceLoc, params);
     }
 
-    public AsterixException(ErrorCode error, Serializable... params) {
-        super(error, null, null, params);
-    }
-
-    public AsterixException(ErrorCode error, Throwable cause, Serializable... params) {
-        super(error, cause, null, params);
+    public AsterixException(ErrorCode error, Throwable cause, SourceLocation sourceLoc, Serializable... params) {
+        super(error, cause, sourceLoc, params);
     }
 
     /**
@@ -65,12 +82,4 @@
     public AsterixException(String message, Throwable cause) {
         super(message, cause);
     }
-
-    public static AsterixException create(ErrorCode error, SourceLocation sourceLoc, Serializable... params) {
-        return new AsterixException(error, sourceLoc, params);
-    }
-
-    public static AsterixException create(ErrorCode error, Serializable... params) {
-        return new AsterixException(error, params);
-    }
 }
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/MetadataException.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/MetadataException.java
index 13a006d..2c54866 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/MetadataException.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/MetadataException.java
@@ -59,20 +59,20 @@
         super(message, cause);
     }
 
-    public MetadataException(ErrorCode errorCode, Throwable cause, SourceLocation sourceLoc, Serializable... params) {
-        super(errorCode, cause, sourceLoc, params);
-    }
-
-    public MetadataException(ErrorCode errorCode, SourceLocation sourceLoc, Serializable... params) {
-        this(errorCode, null, sourceLoc, params);
+    public MetadataException(ErrorCode errorCode, Serializable... params) {
+        this(errorCode, null, null, params);
     }
 
     public MetadataException(ErrorCode errorCode, Throwable cause, Serializable... params) {
         this(errorCode, cause, null, params);
     }
 
-    public MetadataException(ErrorCode errorCode, Serializable... params) {
-        this(errorCode, null, null, params);
+    public MetadataException(ErrorCode errorCode, SourceLocation sourceLoc, Serializable... params) {
+        this(errorCode, null, sourceLoc, params);
+    }
+
+    public MetadataException(ErrorCode errorCode, Throwable cause, SourceLocation sourceLoc, Serializable... params) {
+        super(errorCode, cause, sourceLoc, params);
     }
 
     public static MetadataException create(Throwable cause) {
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/aws/AwsS3InputStream.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/aws/AwsS3InputStream.java
index f950feb..a9f1234 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/aws/AwsS3InputStream.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/aws/AwsS3InputStream.java
@@ -102,17 +102,17 @@
                 } else if (shouldRetry(ex.awsErrorDetails().errorCode(), retries++)) {
                     LOGGER.debug(() -> "S3 retryable error: " + userData(ex.getMessage()));
                 } else {
-                    throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
+                    throw RuntimeDataException.create(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
                 }
 
                 // Backoff for 1 sec for the first 2 retries, and 2 seconds from there onward
                 try {
                     Thread.sleep(TimeUnit.SECONDS.toMillis(retries < 3 ? 1 : 2));
                 } catch (InterruptedException e) {
-                    Thread.currentThread().interrupt();
+                    throw HyracksDataException.create(e);
                 }
             } catch (SdkException ex) {
-                throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
+                throw RuntimeDataException.create(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
             }
         }
         return true;
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/google/gcs/GCSAuthUtils.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/google/gcs/GCSAuthUtils.java
index 4473ad7..4a3f098 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/google/gcs/GCSAuthUtils.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/google/gcs/GCSAuthUtils.java
@@ -190,7 +190,7 @@
         } catch (IOException ex) {
             throw CompilationException.create(EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
         } catch (Exception ex) {
-            throw new CompilationException(EXTERNAL_SOURCE_ERROR,
+            throw CompilationException.create(EXTERNAL_SOURCE_ERROR, ex,
                     "Encountered an issue while processing the JSON credentials. Please ensure the provided credentials are valid.");
         }
     }
diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/functions/ExternalFunctionCompilerUtil.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/functions/ExternalFunctionCompilerUtil.java
index 404c4e7..765c2d3 100644
--- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/functions/ExternalFunctionCompilerUtil.java
+++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/functions/ExternalFunctionCompilerUtil.java
@@ -150,7 +150,7 @@
         try {
             return ExternalFunctionLanguage.valueOf(language);
         } catch (IllegalArgumentException e) {
-            throw new AsterixException(ErrorCode.METADATA_ERROR, language);
+            throw new AsterixException(ErrorCode.METADATA_ERROR, e, language);
         }
     }
 
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/common/ExpressionTypeComputer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/common/ExpressionTypeComputer.java
index e581140..466e5a6 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/common/ExpressionTypeComputer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/common/ExpressionTypeComputer.java
@@ -54,10 +54,9 @@
                 try {
                     return env.getVarType(((VariableReferenceExpression) expr).getVariableReference());
                 } catch (Exception e) {
-                    throw new CompilationException(ErrorCode.COMPILATION_ERROR, expr.getSourceLocation(),
-                            "Could not resolve type for " + expr.toString() + ","
-                                    + "please check whether the used variable has been defined!",
-                            e);
+                    throw new CompilationException(ErrorCode.COMPILATION_ERROR, e, expr.getSourceLocation(),
+                            "Could not resolve type for " + expr + ","
+                                    + "please check whether the used variable has been defined!");
                 }
             default:
                 throw new IllegalStateException();
diff --git a/hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/exceptions/AlgebricksException.java b/hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/exceptions/AlgebricksException.java
index 483076b..a513dd3 100644
--- a/hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/exceptions/AlgebricksException.java
+++ b/hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/exceptions/AlgebricksException.java
@@ -19,8 +19,6 @@
 package org.apache.hyracks.algebricks.common.exceptions;
 
 import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.util.Optional;
 
@@ -44,12 +42,42 @@
     @SuppressWarnings("squid:S1165") // exception class not final
     private transient volatile String msgCache;
 
+    public static AlgebricksException create(ErrorCode error, Serializable... params) {
+        return new AlgebricksException(error, params);
+    }
+
+    public static AlgebricksException create(ErrorCode error, Throwable th, Serializable... params) {
+        return new AlgebricksException(error, th, params);
+    }
+
     public static AlgebricksException create(ErrorCode error, SourceLocation sourceLoc, Serializable... params) {
         return new AlgebricksException(error, sourceLoc, params);
     }
 
-    public static AlgebricksException create(ErrorCode error, Serializable... params) {
-        return create(error, null, params);
+    public static AlgebricksException create(ErrorCode error, Throwable th, SourceLocation sourceLoc,
+            Serializable... params) {
+        return new AlgebricksException(error, th, sourceLoc, params);
+    }
+
+    public AlgebricksException(ErrorCode error, Serializable... params) {
+        this(error, null, null, params);
+    }
+
+    public AlgebricksException(ErrorCode error, Throwable cause, Serializable... params) {
+        this(error, cause, null, null, params);
+    }
+
+    public AlgebricksException(ErrorCode error, SourceLocation sourceLoc, Serializable... params) {
+        this(error, null, sourceLoc, null, params);
+    }
+
+    protected AlgebricksException(IError error, Throwable cause, SourceLocation sourceLoc, Serializable... params) {
+        this(error, cause, sourceLoc, null, params);
+    }
+
+    protected AlgebricksException(IError error, Throwable cause, SourceLocation sourceLoc, String nodeId,
+            Serializable... params) {
+        this(error, error.component(), error.intValue(), error.errorMessage(), cause, sourceLoc, nodeId, params);
     }
 
     protected AlgebricksException(IError error, String component, int errorCode, String message, Throwable cause,
@@ -91,22 +119,6 @@
         this((IError) null, ErrorMessageUtil.NONE, UNKNOWN, message, cause, null, null);
     }
 
-    public AlgebricksException(Throwable cause, ErrorCode error, Serializable... params) {
-        this(error, error.component(), error.intValue(), error.errorMessage(), cause, null, null, params);
-    }
-
-    public AlgebricksException(ErrorCode error, SourceLocation sourceLoc, Serializable... params) {
-        this(error, error.component(), error.intValue(), error.errorMessage(), null, sourceLoc, null, params);
-    }
-
-    public AlgebricksException(ErrorCode error, Serializable... params) {
-        this(error, null, params);
-    }
-
-    protected AlgebricksException(IError error, Throwable cause, SourceLocation sourceLoc, Serializable... params) {
-        this(error, error.component(), error.intValue(), error.errorMessage(), cause, sourceLoc, null, params);
-    }
-
     @Override
     public String getComponent() {
         return component;
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitorJson.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitorJson.java
index ee125bf..7185c24 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitorJson.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitorJson.java
@@ -505,7 +505,7 @@
             jsonGenerator.writeString(expression.accept(exprVisitor, null));
             return this;
         } catch (IOException e) {
-            throw new AlgebricksException(e, ErrorCode.ERROR_PRINTING_PLAN);
+            throw new AlgebricksException(ErrorCode.ERROR_PRINTING_PLAN, e);
         }
     }
 
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/AbstractRuleController.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/AbstractRuleController.java
index 9a47b8a..dca5d62 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/AbstractRuleController.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/AbstractRuleController.java
@@ -147,7 +147,7 @@
         try {
             context.getPlanStabilityVerifier().recordPlanSignature(opRef);
         } catch (AlgebricksException e) {
-            throw AlgebricksException.create(ErrorCode.ILLEGAL_STATE,
+            throw AlgebricksException.create(ErrorCode.ILLEGAL_STATE, e,
                     String.format("Illegal state before rule %s. %s", rule.getClass().getName(), e.getMessage()));
         }
     }
@@ -158,7 +158,7 @@
             try {
                 context.getPlanStructureVerifier().verifyPlanStructure(opRef);
             } catch (AlgebricksException e) {
-                throw AlgebricksException.create(ErrorCode.ILLEGAL_STATE,
+                throw AlgebricksException.create(ErrorCode.ILLEGAL_STATE, e,
                         String.format("Fired rule %s produced illegal %s", rule.getClass().getName(), e.getMessage()));
             }
         } else {
@@ -169,7 +169,7 @@
                     printRuleApplication(rule, "not fired, but failed sanity check: " + e.getMessage(), beforePlan,
                             getPlanString(opRef));
                 }
-                throw AlgebricksException.create(ErrorCode.ILLEGAL_STATE,
+                throw AlgebricksException.create(ErrorCode.ILLEGAL_STATE, e,
                         String.format("Non-fired rule %s unexpectedly %s", rule.getClass().getName(), e.getMessage()));
             }
         }
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/HeuristicOptimizer.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/HeuristicOptimizer.java
index 676b9c7..5e2a3be 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/HeuristicOptimizer.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/HeuristicOptimizer.java
@@ -129,7 +129,7 @@
                     context.getPlanStructureVerifier().verifyPlanStructure(opRef);
                 }
             } catch (AlgebricksException e) {
-                throw AlgebricksException.create(ErrorCode.ILLEGAL_STATE,
+                throw AlgebricksException.create(ErrorCode.ILLEGAL_STATE, e,
                         String.format("Initial plan contains illegal %s", e.getMessage()));
             }
         }
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ExceptionUtils.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ExceptionUtils.java
index 859fd40..8e182fb 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ExceptionUtils.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ExceptionUtils.java
@@ -30,6 +30,8 @@
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.exceptions.IFormattedException;
 import org.apache.hyracks.util.ThrowingFunction;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
 import com.google.common.util.concurrent.UncheckedExecutionException;
 
@@ -37,6 +39,7 @@
  * @author yingyib
  */
 public class ExceptionUtils {
+    private static final Logger LOGGER = LogManager.getLogger();
 
     private ExceptionUtils() {
     }
@@ -142,7 +145,18 @@
     }
 
     public static boolean causedByInterrupt(Throwable th) {
-        return getRootCause(th) instanceof InterruptedException;
+        return causedByInterrupt(th, false);
+    }
+
+    public static boolean causedByInterrupt(Throwable th, boolean skipInterruptedCheck) {
+        if (th instanceof InterruptedException) {
+            return true;
+        }
+        boolean isCausedByInterrupt = getRootCause(th) instanceof InterruptedException;
+        if (!skipInterruptedCheck && isCausedByInterrupt && !Thread.currentThread().isInterrupted()) {
+            LOGGER.warn("InterruptedException suppressed and !Thread.currentThread().isInterrupted()", th);
+        }
+        return isCausedByInterrupt;
     }
 
     /**