Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

57024: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3)
      56491: Merged HEAD-BUG-FIX to V4.2-BUG-FIX (4.2.1)
         55495: <<NOT IN 4.1.6>> Merged V4.1-BUG-FIX (4.1.7) to HEAD-BUG-FIX (4.2)
            55338: Merged DEV to V4.1-BUG-FIX
               50363: MNT-644: imap subsystem lists all directories if an email is moved to Alfresco and decreases the performance of Email client
                  Preventing caching on each AlfrescoImapHostManager.getFolder() method call


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@61657 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-02-11 18:39:00 +00:00
parent c5f23647cc
commit 1dcd0cd002

View File

@@ -228,20 +228,15 @@ public class AlfrescoImapHostManager implements ImapHostManager
AlfrescoImapUser alfrescoUser = new AlfrescoImapUser(user.getEmail(), user.getLogin(), user.getPassword()); AlfrescoImapUser alfrescoUser = new AlfrescoImapUser(user.getEmail(), user.getLogin(), user.getPassword());
String folderPath = getUnqualifiedMailboxPattern( String folderPath = getUnqualifiedMailboxPattern(
alfrescoUser, mailboxName); alfrescoUser, mailboxName);
// Warm up the cache if necessary
if (folderCache == null) if (folderCache == null)
{ {
registerMailboxes(imapService.listMailboxes(alfrescoUser, "*", true)); registerMailBox(imapService.getOrCreateMailbox(alfrescoUser, mailboxName, true, false));
}
// Try to retrieve from the cache
AlfrescoImapFolder result = folderCache.get(folderPath);
if (result != null && result.reset())
{
return result;
} }
// Look up and cache as a last resort AlfrescoImapFolder result = folderCache.get(folderPath);
return registerMailBox(imapService.getOrCreateMailbox(alfrescoUser, folderPath, true, false));
return result;
} }
/** /**
@@ -370,7 +365,12 @@ public class AlfrescoImapHostManager implements ImapHostManager
private MailFolder registerMailBox(AlfrescoImapFolder mailbox) private MailFolder registerMailBox(AlfrescoImapFolder mailbox)
{ {
String folderPath = mailbox.getFolderPath(); String folderPath = mailbox.getFolderPath();
if ((mailbox.isSelectable() || folderPath.isEmpty()) && folderCache != null) if (folderCache == null)
{
folderCache = new HashMap<String, AlfrescoImapFolder>(2);
}
if ((mailbox.isSelectable() || folderPath.isEmpty()))
{ {
AlfrescoImapFolder oldFolder = folderCache.get(folderPath); AlfrescoImapFolder oldFolder = folderCache.get(folderPath);
if (oldFolder != null if (oldFolder != null