You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2024/01/22 09:41:33 UTC

(camel) 01/03: CAMEL-20297 camel-etcd3: do not swallow interrupted exceptions

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 b301fa6e557fe676ad02421f4bcdc9b98856e4cf
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Fri Jan 19 11:00:02 2024 +0100

    CAMEL-20297 camel-etcd3: do not swallow interrupted exceptions
    
    Leftovers from bc4a7ec519806216445cc10e5d38c68d78a5f4c3
---
 .../etcd3/processor/aggregate/Etcd3AggregationRepository.java    | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/components/camel-etcd3/src/main/java/org/apache/camel/component/etcd3/processor/aggregate/Etcd3AggregationRepository.java b/components/camel-etcd3/src/main/java/org/apache/camel/component/etcd3/processor/aggregate/Etcd3AggregationRepository.java
index 2ee2f9fb0c1..83a3e661fd8 100644
--- a/components/camel-etcd3/src/main/java/org/apache/camel/component/etcd3/processor/aggregate/Etcd3AggregationRepository.java
+++ b/components/camel-etcd3/src/main/java/org/apache/camel/component/etcd3/processor/aggregate/Etcd3AggregationRepository.java
@@ -444,6 +444,9 @@ public class Etcd3AggregationRepository extends ServiceSupport
                     LOG.trace(
                             "Put an exchange with ID {} for key {} into a recoverable storage in a thread-safe manner.",
                             exchange.getExchangeId(), key);
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                    throw new RuntimeCamelException(e.getMessage(), e);
                 } catch (Exception exception) {
                     throw new RuntimeCamelException(exception.getMessage(), exception);
                 }
@@ -493,7 +496,11 @@ public class Etcd3AggregationRepository extends ServiceSupport
             Set<String> keys = new TreeSet<>();
             getResponse.getKvs().forEach(kv -> keys.add(new String(kv.getKey().getBytes())));
             scanned = Collections.unmodifiableSet(keys);
-        } catch (InterruptedException | ExecutionException e) {
+        } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+            LOG.error(e.getMessage(), e);
+            throw new RuntimeCamelException(e.getMessage(), e);
+        } catch (ExecutionException e) {
             LOG.error(e.getMessage(), e);
             throw new RuntimeCamelException(e.getMessage(), e);
         }