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 09:05:00 UTC

(camel) branch main updated: CAMEL-20297 camel-file: 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


The following commit(s) were added to refs/heads/main by this push:
     new 6728c18c74c CAMEL-20297 camel-file: do not swallow interrupted exceptions
6728c18c74c is described below

commit 6728c18c74c9c6aca45bb227fb903f297dafcc6f
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Fri Jan 12 10:38:37 2024 +0100

    CAMEL-20297 camel-file: do not swallow interrupted exceptions
---
 .../org/apache/camel/component/file/GenericFilePollingConsumer.java     | 2 +-
 .../component/file/strategy/FileChangedExclusiveReadLockStrategy.java   | 1 +
 .../component/file/strategy/FileLockExclusiveReadLockStrategy.java      | 1 +
 .../file/strategy/GenericFileRenameExclusiveReadLockStrategy.java       | 1 +
 4 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFilePollingConsumer.java b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFilePollingConsumer.java
index a30b05f8191..68c9474b44e 100644
--- a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFilePollingConsumer.java
+++ b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFilePollingConsumer.java
@@ -176,7 +176,7 @@ public class GenericFilePollingConsumer extends EventDrivenPollingConsumer {
                         // sleep for next pool
                         sleep(min);
                     } catch (InterruptedException e) {
-                        // ignore
+                        Thread.currentThread().interrupt();
                     }
                 } else {
                     // timeout hit
diff --git a/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/FileChangedExclusiveReadLockStrategy.java b/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/FileChangedExclusiveReadLockStrategy.java
index c3d01f0880f..17f4dfef034 100644
--- a/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/FileChangedExclusiveReadLockStrategy.java
+++ b/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/FileChangedExclusiveReadLockStrategy.java
@@ -116,6 +116,7 @@ public class FileChangedExclusiveReadLockStrategy extends MarkerFileExclusiveRea
             Thread.sleep(checkInterval);
             return false;
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.debug("Sleep interrupted while waiting for exclusive read lock, so breaking out");
             return true;
         }
diff --git a/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/FileLockExclusiveReadLockStrategy.java b/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/FileLockExclusiveReadLockStrategy.java
index f0bf652dd0f..04a77a6e5f3 100644
--- a/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/FileLockExclusiveReadLockStrategy.java
+++ b/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/FileLockExclusiveReadLockStrategy.java
@@ -184,6 +184,7 @@ public class FileLockExclusiveReadLockStrategy extends MarkerFileExclusiveReadLo
             Thread.sleep(checkInterval);
             return false;
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.debug("Sleep interrupted while waiting for exclusive read lock, so breaking out");
             return true;
         }
diff --git a/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/GenericFileRenameExclusiveReadLockStrategy.java b/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/GenericFileRenameExclusiveReadLockStrategy.java
index 389f1611f30..68b4641320f 100644
--- a/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/GenericFileRenameExclusiveReadLockStrategy.java
+++ b/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/GenericFileRenameExclusiveReadLockStrategy.java
@@ -126,6 +126,7 @@ public class GenericFileRenameExclusiveReadLockStrategy<T> implements GenericFil
             Thread.sleep(checkInterval);
             return false;
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.debug("Sleep interrupted while waiting for exclusive read lock, so breaking out");
             return true;
         }