james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [6/8] james-project git commit: MAILBOX-285 Allow message removal during CassandraMessageMapper :: setFlags
Date Wed, 18 Jan 2017 07:52:00 GMT
MAILBOX-285 Allow message removal during CassandraMessageMapper :: setFlags


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

Branch: refs/heads/master
Commit: 1bd6c7cd28fa6342db7572b3e4e978cd9e678a5b
Parents: 16bba83
Author: Benoit Tellier <btellier@linagora.com>
Authored: Wed Jan 11 18:38:38 2017 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Tue Jan 17 10:44:41 2017 +0700

----------------------------------------------------------------------
 .../james/mailbox/cassandra/mail/CassandraMessageMapper.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/1bd6c7cd/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java
index 51f2528..e170a66 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java
@@ -55,6 +55,8 @@ import org.apache.james.mailbox.store.mail.UidProvider;
 import org.apache.james.mailbox.store.mail.model.Mailbox;
 import org.apache.james.mailbox.store.mail.model.MailboxMessage;
 import org.apache.james.mailbox.store.mail.model.impl.SimpleMailboxMessage;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.github.fge.lambdas.Throwing;
 import com.github.steveash.guavate.Guavate;
@@ -62,6 +64,7 @@ import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableList;
 
 public class CassandraMessageMapper implements MessageMapper {
+    private static final Logger LOGGER = LoggerFactory.getLogger(CassandraMessageMapper.class);
 
     private final ModSeqProvider modSeqProvider;
     private final MailboxSession mailboxSession;
@@ -341,6 +344,9 @@ public class CassandraMessageMapper implements MessageMapper {
         } catch (MessageDeletedDuringFlagsUpdateException e) {
             mailboxSession.getLog().warn(e.getMessage());
             return Optional.empty();
+        } catch (MailboxDeleteDuringUpdateException e) {
+            LOGGER.info("Mailbox {} was deleted during flag update", mailbox.getMailboxId());
+            return Optional.empty();
         } catch (Exception e) {
             throw Throwables.propagate(e);
         }
@@ -351,7 +357,7 @@ public class CassandraMessageMapper implements MessageMapper {
         ComposedMessageIdWithMetaData composedMessageIdWithMetaData = imapUidDAO.retrieve((CassandraMessageId)
messageId, Optional.of(cassandraId))
             .join()
             .findFirst()
-            .orElseThrow(MailboxDeleteDuringUpdate::new);
+            .orElseThrow(MailboxDeleteDuringUpdateException::new);
         return tryMessageFlagsUpdate(flagUpdateCalculator,
                 mailbox,
                 messageDAO.retrieveMessages(ImmutableList.of(composedMessageIdWithMetaData),
FetchType.Metadata, Optional.empty()).join()


---------------------------------------------------------------------
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