james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [3/5] james-project git commit: JAMES-1790 stop logging errors when stopping MailQueue
Date Fri, 08 Jul 2016 14:46:38 GMT
JAMES-1790 stop logging errors when stopping MailQueue


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/2a7c50f5
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/2a7c50f5
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/2a7c50f5

Branch: refs/heads/master
Commit: 2a7c50f5f40ed43ff0e6fcef5faa1fcf097e3ca6
Parents: 1c294dd
Author: Matthieu Baechler <matthieu.baechler@linagora.com>
Authored: Mon Jul 4 11:34:23 2016 +0200
Committer: Antoine Duprat <aduprat@linagora.com>
Committed: Fri Jul 8 14:24:55 2016 +0200

----------------------------------------------------------------------
 .../modules/server/MemoryMailQueueFactory.java  | 11 +++-------
 .../mailetcontainer/impl/JamesMailSpooler.java  | 21 ++++++++++----------
 .../org/apache/james/queue/api/MailQueue.java   |  4 +---
 3 files changed, 15 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/2a7c50f5/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/server/MemoryMailQueueFactory.java
----------------------------------------------------------------------
diff --git a/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/server/MemoryMailQueueFactory.java
b/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/server/MemoryMailQueueFactory.java
index 75466e4..c1f92b1 100644
--- a/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/server/MemoryMailQueueFactory.java
+++ b/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/server/MemoryMailQueueFactory.java
@@ -33,7 +33,6 @@ import org.apache.james.queue.api.MailQueueItemDecoratorFactory;
 import org.apache.mailet.Mail;
 
 import com.google.common.base.Objects;
-import com.google.common.base.Throwables;
 import com.google.inject.Inject;
 
 public class MemoryMailQueueFactory implements MailQueueFactory {
@@ -86,14 +85,10 @@ public class MemoryMailQueueFactory implements MailQueueFactory {
         }
 
         @Override
-        public MailQueueItem deQueue() throws MailQueueException {
+        public MailQueueItem deQueue() throws MailQueueException, InterruptedException {
             while (true) {
-                try {
-                    MemoryMailQueueItem item = mailItems.take();
-                    return mailQueueItemDecoratorFactory.decorate(item);
-                } catch (InterruptedException e) {
-                    Throwables.propagate(e);
-                }
+                MemoryMailQueueItem item = mailItems.take();
+                return mailQueueItemDecoratorFactory.decorate(item);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a7c50f5/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailSpooler.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailSpooler.java
b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailSpooler.java
index ccfed91..f2c3e47 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailSpooler.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailSpooler.java
@@ -19,6 +19,14 @@
 
 package org.apache.james.mailetcontainer.impl;
 
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.HierarchicalConfiguration;
 import org.apache.james.lifecycle.api.Configurable;
@@ -35,13 +43,6 @@ import org.apache.james.util.concurrent.JMXEnabledThreadPoolExecutor;
 import org.apache.mailet.Mail;
 import org.slf4j.Logger;
 
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.inject.Inject;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-
 /**
  * Manages the mail spool. This class is responsible for retrieving messages
  * from the spool, directing messages to the appropriate processor, and removing
@@ -192,11 +193,11 @@ public class JamesMailSpooler implements Runnable, Disposable, Configurable,
Log
                     logger.error("Exception dequeue mail", e1);
 
                 }
+            } catch (InterruptedException interrupted) {
+                //MailSpooler is stopping
             }
         }
-        if (logger.isInfoEnabled()) {
-            logger.info("Stop " + getClass().getName() + ": " + Thread.currentThread().getName());
-        }
+        logger.info("Stop {} : {}", getClass().getName(), Thread.currentThread().getName());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a7c50f5/server/queue/queue-api/src/main/java/org/apache/james/queue/api/MailQueue.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-api/src/main/java/org/apache/james/queue/api/MailQueue.java
b/server/queue/queue-api/src/main/java/org/apache/james/queue/api/MailQueue.java
index ca82525..67c9282 100644
--- a/server/queue/queue-api/src/main/java/org/apache/james/queue/api/MailQueue.java
+++ b/server/queue/queue-api/src/main/java/org/apache/james/queue/api/MailQueue.java
@@ -86,10 +86,8 @@ public interface MailQueue {
      * block until a Mail is ready and then process the operation.
      * Implementations should take care todo some kind of transactions to not
      * loose any mail on error
-     * 
-     * @throws MailQueueException
      */
-    MailQueueItem deQueue() throws MailQueueException;
+    MailQueueItem deQueue() throws MailQueueException, InterruptedException;
 
     /**
      * Exception which will get thrown if any problems occur while working the


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


Mime
View raw message