Author: btellier
Date: Sat Nov 28 12:52:40 2015
New Revision: 1716951
URL: http://svn.apache.org/viewvc?rev=1716951&view=rev
Log:
MAILBOX-211 Indent CacheInvalidatingMailboxListener
Modified:
james/project/trunk/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CacheInvalidatingMailboxListener.java
Modified:
james/project/trunk/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CacheInvalidatingMailboxListener.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CacheInvalidatingMailboxListener.java?rev=1716951&r1=1716950&r2=1716951&view=diff
==============================================================================
---
james/project/trunk/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CacheInvalidatingMailboxListener.java
(original)
+++
james/project/trunk/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CacheInvalidatingMailboxListener.java
Sat Nov 28 12:52:40 2015
@@ -6,54 +6,54 @@ import org.apache.james.mailbox.exceptio
import org.apache.james.mailbox.store.mail.model.MailboxId;
/**
* A MailboxListener that invalidates the configured caches in response to
Events
- *
+ *
* @param <Id>
*/
public class CacheInvalidatingMailboxListener<Id extends MailboxId> implements
MailboxListener {
- private MailboxByPathCache<Id> mailboxCacheByPath;
- private MailboxMetadataCache<Id> mailboxMetadataCache;
+ private MailboxByPathCache<Id> mailboxCacheByPath;
+ private MailboxMetadataCache<Id> mailboxMetadataCache;
- public CacheInvalidatingMailboxListener(MailboxByPathCache<Id>
mailboxCacheByPath, MailboxMetadataCache<Id> mailboxMetadataCache) {
- this.mailboxCacheByPath = mailboxCacheByPath;
- this.mailboxMetadataCache = mailboxMetadataCache;
- }
-
- /**
- * Used to register the CacheInvalidatingMailboxListener as a global
listener
- * into the main MailboxListener
- *
- * @param listener
- * @throws MailboxException
- */
- public void register(MailboxListenerSupport listener) throws
MailboxException {
- listener.addGlobalListener(this, null);
- }
-
- @Override
- public void event(Event event) {
- // TODO this needs for sure to be smarter
- try {
- if (event instanceof MessageEvent) {
- // invalidate the metadata caches
- invalidateMetadata(event);
- }
- invalidateMailbox(event);
- } catch (MailboxException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
-
- private void invalidateMetadata(Event event) throws MailboxException {
- //HMM, race conditions welcome?
-
mailboxMetadataCache.invalidate(mailboxCacheByPath.findMailboxByPath(event.getMailboxPath(),
null));
-
- }
-
- private void invalidateMailbox(Event event) {
- mailboxCacheByPath.invalidate(event.getMailboxPath());
- }
+ public CacheInvalidatingMailboxListener(MailboxByPathCache<Id>
mailboxCacheByPath, MailboxMetadataCache<Id> mailboxMetadataCache) {
+ this.mailboxCacheByPath = mailboxCacheByPath;
+ this.mailboxMetadataCache = mailboxMetadataCache;
+ }
+
+ /**
+ * Used to register the CacheInvalidatingMailboxListener as a global
listener
+ * into the main MailboxListener
+ *
+ * @param listener
+ * @throws MailboxException
+ */
+ public void register(MailboxListenerSupport listener) throws
MailboxException {
+ listener.addGlobalListener(this, null);
+ }
+
+ @Override
+ public void event(Event event) {
+ // TODO this needs for sure to be smarter
+ try {
+ if (event instanceof MessageEvent) {
+ // invalidate the metadata caches
+ invalidateMetadata(event);
+ }
+ invalidateMailbox(event);
+ } catch (MailboxException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ private void invalidateMetadata(Event event) throws MailboxException {
+ //HMM, race conditions welcome?
+
mailboxMetadataCache.invalidate(mailboxCacheByPath.findMailboxByPath(event.getMailboxPath(),
null));
+
+ }
+
+ private void invalidateMailbox(Event event) {
+ mailboxCacheByPath.invalidate(event.getMailboxPath());
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]