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

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit ff48bbc4d2e4aacdbdb3c4c59d70ab7c8cf9a45a
Author: Otavio Rodolfo Piske <angusyo...@gmail.com>
AuthorDate: Tue Jan 16 11:01:43 2024 +0100

    CAMEL-20297 camel-support: do not swallow interrupted exceptions
---
 .../main/java/org/apache/camel/support/EventDrivenPollingConsumer.java | 3 ++-
 .../src/main/java/org/apache/camel/support/ExchangeHelper.java         | 2 ++
 .../org/apache/camel/support/FileWatcherResourceReloadStrategy.java    | 2 ++
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/EventDrivenPollingConsumer.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/EventDrivenPollingConsumer.java
index ebce7dbba9c..779d8da4b65 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/EventDrivenPollingConsumer.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/EventDrivenPollingConsumer.java
@@ -193,7 +193,7 @@ public class EventDrivenPollingConsumer extends 
PollingConsumerSupport implement
                     }
                 }
             } catch (InterruptedException e) {
-                // ignore
+                Thread.currentThread().interrupt();
                 LOG.debug("Put interrupted, are we stopping? {}", isStopping() 
|| isStopped());
             }
         } else {
@@ -228,6 +228,7 @@ public class EventDrivenPollingConsumer extends 
PollingConsumerSupport implement
     }
 
     protected void handleInterruptedException(InterruptedException e) {
+        Thread.currentThread().interrupt();
         getInterruptedExceptionHandler().handleException(e);
     }
 
diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/ExchangeHelper.java 
b/core/camel-support/src/main/java/org/apache/camel/support/ExchangeHelper.java
index 81eb2e51647..b1097243892 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/ExchangeHelper.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/ExchangeHelper.java
@@ -711,6 +711,7 @@ public final class ExchangeHelper {
         try {
             return doExtractFutureBody(context, future.get(), type);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             throw RuntimeCamelException.wrapRuntimeCamelException(e);
         } catch (ExecutionException e) {
             // execution failed due to an exception so rethrow the cause
@@ -747,6 +748,7 @@ public final class ExchangeHelper {
             }
         } catch (InterruptedException e) {
             // execution failed due interruption so rethrow the cause
+            Thread.currentThread().interrupt();
             throw CamelExecutionException.wrapCamelExecutionException(null, e);
         } catch (ExecutionException e) {
             // execution failed due to an exception so rethrow the cause
diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/FileWatcherResourceReloadStrategy.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/FileWatcherResourceReloadStrategy.java
index 13eba8c0977..35ffa8dfd84 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/FileWatcherResourceReloadStrategy.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/FileWatcherResourceReloadStrategy.java
@@ -277,6 +277,8 @@ public class FileWatcherResourceReloadStrategy extends 
ResourceReloadStrategySup
                     // wait for a key to be available
                     key = watcher.poll(pollTimeout, TimeUnit.MILLISECONDS);
                 } catch (InterruptedException ex) {
+                    LOG.info("Interrupted while polling for file changes");
+                    Thread.currentThread().interrupt();
                     break;
                 }
 

Reply via email to