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/15 13:21:01 UTC

(camel) 01/10: CAMEL-20297 camel-jpa: 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 938422492fca115dfd60274aa3fdcfb910843827
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Mon Jan 15 11:04:55 2024 +0100

    CAMEL-20297 camel-jpa: do not swallow interrupted exceptions
---
 .../main/java/org/apache/camel/component/jpa/JpaPollingConsumer.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaPollingConsumer.java b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaPollingConsumer.java
index 8489e16157e..0564411a47c 100644
--- a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaPollingConsumer.java
+++ b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaPollingConsumer.java
@@ -199,7 +199,10 @@ public class JpaPollingConsumer extends PollingConsumerSupport {
         Future<Exchange> future = executorService.submit((Callable<Exchange>) this::receive);
         try {
             return future.get(timeout, TimeUnit.MILLISECONDS);
-        } catch (ExecutionException | InterruptedException e) {
+        } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+            throw RuntimeCamelException.wrapRuntimeCamelException(e);
+        } catch (ExecutionException e) {
             throw RuntimeCamelException.wrapRuntimeCamelException(e);
         } catch (TimeoutException e) {
             // ignore as we hit timeout then return null