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 1c73ce90679ab0cc5e5bdb36b4e221462af7ef56
Author: Otavio Rodolfo Piske <angusyo...@gmail.com>
AuthorDate: Fri Jan 5 11:19:53 2024 +0100

    CAMEL-20297 camel-seda: do not swallow interrupted exceptions
---
 .../main/java/org/apache/camel/component/seda/SedaConsumer.java   | 5 ++++-
 .../main/java/org/apache/camel/component/seda/SedaProducer.java   | 8 ++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git 
a/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
 
b/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
index 1cc1964e84b..1f04eded390 100644
--- 
a/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
+++ 
b/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
@@ -102,7 +102,7 @@ public class SedaConsumer extends DefaultConsumer 
implements Runnable, ShutdownA
             try {
                 latch.await();
             } catch (InterruptedException e) {
-                // ignore
+                Thread.currentThread().interrupt();
             }
         }
     }
@@ -147,6 +147,7 @@ public class SedaConsumer extends DefaultConsumer 
implements Runnable, ShutdownA
                     Thread.sleep(Math.min(pollTimeout, 1000));
                 } catch (InterruptedException e) {
                     LOG.debug("Sleep interrupted, are we stopping? {}", 
isStopping() || isStopped());
+                    Thread.currentThread().interrupt();
                 }
                 continue;
             }
@@ -165,6 +166,7 @@ public class SedaConsumer extends DefaultConsumer 
implements Runnable, ShutdownA
                         Thread.sleep(Math.min(pollTimeout, 1000));
                     } catch (InterruptedException e) {
                         LOG.debug("Sleep interrupted, are we stopping? {}", 
isStopping() || isStopped());
+                        Thread.currentThread().interrupt();
                     }
                     continue;
                 }
@@ -201,6 +203,7 @@ public class SedaConsumer extends DefaultConsumer 
implements Runnable, ShutdownA
                 }
             } catch (InterruptedException e) {
                 LOG.debug("Sleep interrupted, are we stopping? {}", 
isStopping() || isStopped());
+                Thread.currentThread().interrupt();
                 continue;
             } catch (Exception e) {
                 if (exchange != null) {
diff --git 
a/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaProducer.java
 
b/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaProducer.java
index 7d6761e7dc7..c9f0ad6e99a 100644
--- 
a/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaProducer.java
+++ 
b/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaProducer.java
@@ -122,7 +122,7 @@ public class SedaProducer extends DefaultAsyncProducer {
                 try {
                     done = latch.await(timeout, TimeUnit.MILLISECONDS);
                 } catch (InterruptedException e) {
-                    // ignore
+                    Thread.currentThread().interrupt();
                 }
                 if (!done) {
                     exchange.setException(new 
ExchangeTimedOutException(exchange, timeout));
@@ -139,7 +139,7 @@ public class SedaProducer extends DefaultAsyncProducer {
                 try {
                     latch.await();
                 } catch (InterruptedException e) {
-                    // ignore
+                    Thread.currentThread().interrupt();
                 }
             }
         } else {
@@ -222,15 +222,15 @@ public class SedaProducer extends DefaultAsyncProducer {
                     LOG.trace("Discarding Exchange as queue is full: {}", 
target);
                 }
             } catch (InterruptedException e) {
-                // ignore
                 LOG.debug("Offer interrupted, are we stopping? {}", 
isStopping() || isStopped());
+                Thread.currentThread().interrupt();
             }
         } else if (blockWhenFull && offerTimeout == 0) {
             try {
                 queue.put(target);
             } catch (InterruptedException e) {
-                // ignore
                 LOG.debug("Put interrupted, are we stopping? {}", isStopping() 
|| isStopped());
+                Thread.currentThread().interrupt();
             }
         } else if (blockWhenFull && offerTimeout > 0) {
             try {

Reply via email to