james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [06/15] james-project git commit: MAILBOX-317 Bonus: Avoid using a null system session during required listener registration
Date Fri, 03 Nov 2017 02:33:23 GMT
MAILBOX-317 Bonus: Avoid using a null system session during required listener registration


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

Branch: refs/heads/master
Commit: b9be0917af11b2e20d8ada13a97902426b92e61b
Parents: ce3583a
Author: benwa <btellier@linagora.com>
Authored: Thu Nov 2 13:03:14 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Fri Nov 3 09:32:32 2017 +0700

----------------------------------------------------------------------
 .../james/mailbox/store/StoreMailboxManager.java       | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/b9be0917/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
index c13248d..b4f6433 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
@@ -206,15 +206,15 @@ public class StoreMailboxManager implements MailboxManager {
      */
     @PostConstruct
     public void init() throws MailboxException {
+        if (idGenerator == null) {
+            idGenerator = new RandomMailboxSessionIdGenerator();
+        }
+        MailboxSession session = createSystemSession("storeMailboxManager");
         if (index == null) {
             index = new SimpleMessageSearchIndex(mailboxSessionMapperFactory, mailboxSessionMapperFactory,
new DefaultTextExtractor());
         }
         if (index instanceof ListeningMessageSearchIndex) {
-            this.addGlobalListener((MailboxListener) index, null);
-        }
-
-        if (idGenerator == null) {
-            idGenerator = new RandomMailboxSessionIdGenerator();
+            this.addGlobalListener((MailboxListener) index, session);
         }
         if (quotaManager == null) {
             quotaManager = new NoQuotaManager();
@@ -223,7 +223,7 @@ public class StoreMailboxManager implements MailboxManager {
             quotaRootResolver = new DefaultQuotaRootResolver(mailboxSessionMapperFactory);
         }
         if (quotaUpdater != null && quotaUpdater instanceof MailboxListener) {
-            this.addGlobalListener((MailboxListener) quotaUpdater, null);
+            this.addGlobalListener((MailboxListener) quotaUpdater, session);
         }
         if (copyBatcher == null) {
             copyBatcher = new MessageBatcher(MessageBatcher.NO_BATCH_SIZE);
@@ -232,7 +232,6 @@ public class StoreMailboxManager implements MailboxManager {
             moveBatcher = new MessageBatcher(MessageBatcher.NO_BATCH_SIZE);
         }
         if (hasCapability(MailboxCapabilities.Annotation)) {
-            MailboxSession session = null;
             this.addGlobalListener(new MailboxAnnotationListener(mailboxSessionMapperFactory),
session);
         }
     }


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