MAILBOX-354 MailboxListenerRegistry does not need to throw
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/d22fe0eb Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/d22fe0eb Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/d22fe0eb Branch: refs/heads/master Commit: d22fe0ebfbc2d972559112c867679ff54ad6d65c Parents: b853de8 Author: Benoit Tellier <btell...@linagora.com> Authored: Fri Nov 30 10:42:59 2018 +0700 Committer: Benoit Tellier <btell...@linagora.com> Committed: Tue Dec 4 15:47:32 2018 +0700 ---------------------------------------------------------------------- .../mailbox/store/event/MailboxListenerRegistry.java | 11 +++++------ .../modules/mailbox/MailboxListenersLoaderImpl.java | 8 +------- 2 files changed, 6 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/d22fe0eb/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MailboxListenerRegistry.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MailboxListenerRegistry.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MailboxListenerRegistry.java index f68a7c8..d29caff 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MailboxListenerRegistry.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MailboxListenerRegistry.java @@ -23,7 +23,6 @@ import java.util.List; import java.util.concurrent.ConcurrentLinkedQueue; import org.apache.james.mailbox.MailboxListener; -import org.apache.james.mailbox.exception.MailboxException; import org.apache.james.mailbox.model.MailboxPath; import com.google.common.collect.HashMultimap; @@ -38,22 +37,22 @@ public class MailboxListenerRegistry { public MailboxListenerRegistry() { this.globalListeners = new ConcurrentLinkedQueue<>(); - this.listeners = Multimaps.synchronizedMultimap(HashMultimap.<MailboxPath, MailboxListener>create()); + this.listeners = Multimaps.synchronizedMultimap(HashMultimap.create()); } - public void addListener(MailboxPath path, MailboxListener listener) throws MailboxException { + public void addListener(MailboxPath path, MailboxListener listener) { listeners.put(path, listener); } - public void addGlobalListener(MailboxListener listener) throws MailboxException { + public void addGlobalListener(MailboxListener listener) { globalListeners.add(listener); } - public void removeListener(MailboxPath mailboxPath, MailboxListener listener) throws MailboxException { + public void removeListener(MailboxPath mailboxPath, MailboxListener listener) { listeners.remove(mailboxPath, listener); } - public void removeGlobalListener(MailboxListener listener) throws MailboxException { + public void removeGlobalListener(MailboxListener listener) { globalListeners.remove(listener); } http://git-wip-us.apache.org/repos/asf/james-project/blob/d22fe0eb/server/container/guice/mailbox/src/main/java/org/apache/james/modules/mailbox/MailboxListenersLoaderImpl.java ---------------------------------------------------------------------- diff --git a/server/container/guice/mailbox/src/main/java/org/apache/james/modules/mailbox/MailboxListenersLoaderImpl.java b/server/container/guice/mailbox/src/main/java/org/apache/james/modules/mailbox/MailboxListenersLoaderImpl.java index 866553c..44dc178 100644 --- a/server/container/guice/mailbox/src/main/java/org/apache/james/modules/mailbox/MailboxListenersLoaderImpl.java +++ b/server/container/guice/mailbox/src/main/java/org/apache/james/modules/mailbox/MailboxListenersLoaderImpl.java @@ -23,7 +23,6 @@ import java.util.Set; import org.apache.commons.configuration.HierarchicalConfiguration; import org.apache.james.lifecycle.api.Configurable; import org.apache.james.mailbox.MailboxListener; -import org.apache.james.mailbox.exception.MailboxException; import org.apache.james.mailbox.store.event.MailboxListenerRegistry; import org.apache.james.utils.ExtendedClassLoader; import org.slf4j.Logger; @@ -64,12 +63,7 @@ public class MailboxListenersLoaderImpl implements Configurable, MailboxListener @Override public void register(MailboxListener listener) { - try { - registry.addGlobalListener(listener); - } catch (MailboxException e) { - LOGGER.error("Error while registering global listener {}", listener, e); - throw new RuntimeException(e); - } + registry.addGlobalListener(listener); } @Override --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org