You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2022/08/02 17:32:57 UTC

[brooklyn-server] 03/06: simplify exceptions we throw for interruption

This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git

commit eed49eeb702b5a7d5d7ab9ad85e1727e2701037f
Author: Alex Heneveld <al...@cloudsoft.io>
AuthorDate: Tue Aug 2 13:27:43 2022 +0100

    simplify exceptions we throw for interruption
---
 .../src/main/java/org/apache/brooklyn/util/exceptions/Exceptions.java    | 1 +
 1 file changed, 1 insertion(+)

diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/Exceptions.java b/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/Exceptions.java
index 7b7590dc5c..f4a7affb1d 100644
--- a/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/Exceptions.java
+++ b/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/Exceptions.java
@@ -184,6 +184,7 @@ public class Exceptions {
         if (throwable!=null && (throwable instanceof InterruptedException || throwable instanceof RuntimeInterruptedException || Exceptions.isRootCauseIsInterruption(throwable))) {
             // previously only interrupted if we caught RuntimeInterrupted; but best seems to be to always set the interrupted bit
             Thread.currentThread().interrupt();
+            if (throwable instanceof RuntimeException) throw (RuntimeException) throwable;
             throw new RuntimeInterruptedException(throwable);
         }
     }