You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2024/06/05 02:16:10 UTC

(james-project) branch 3.8.x updated: JAMES-4036 JMS mailQueue should silent interuptedExceptions upon shutdown

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

rcordier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git


The following commit(s) were added to refs/heads/3.8.x by this push:
     new ed86010a39 JAMES-4036 JMS mailQueue should silent interuptedExceptions upon shutdown
ed86010a39 is described below

commit ed86010a39c1c9c0e4d9eb0b17169069f7fcb7f5
Author: Benoit TELLIER <bt...@linagora.com>
AuthorDate: Tue May 21 21:46:09 2024 +0200

    JAMES-4036 JMS mailQueue should silent interuptedExceptions upon shutdown
---
 .../org/apache/james/queue/jms/JMSCacheableMailQueue.java | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/server/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSCacheableMailQueue.java b/server/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSCacheableMailQueue.java
index af3f80bd05..d2edafebea 100644
--- a/server/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSCacheableMailQueue.java
+++ b/server/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSCacheableMailQueue.java
@@ -253,16 +253,29 @@ public class JMSCacheableMailQueue implements ManageableMailQueue, JMSSupport, M
                 closeConsumer(consumer);
                 closeSession(session);
             }
-
         } catch (Exception e) {
             rollback(session);
             closeConsumer(consumer);
             closeSession(session);
+            if (isInterrupt(e)) {
+                Thread.currentThread().interrupt();
+                return Mono.empty();
+            }
             return Mono.error(new MailQueueException("Unable to dequeue next message", e));
         }
         return Mono.empty();
     }
 
+    private static boolean isInterrupt(Throwable e) {
+        if (e instanceof InterruptedException) {
+            return true;
+        }
+        if (e == null) {
+            return false;
+        }
+        return isInterrupt(e.getCause());
+    }
+
     @Override
     public void enQueue(Mail mail, Duration delay) throws MailQueueException {
         TimeMetric timeMetric = metricFactory.timer(ENQUEUED_TIMER_METRIC_NAME_PREFIX + queueName.asString());


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org