Exemplo n.º 1
0
  public void synchronizeFolder(long folderId) throws PortalException, SystemException {

    if (_log.isDebugEnabled()) {
      _log.debug("Synchronizing folder " + folderId);
    }

    String key = AccountLock.getKey(user.getUserId(), account.getAccountId());

    if (AccountLock.acquireLock(key)) {
      try {
        _imapAccessor.storeEnvelopes(folderId, false);
      } finally {
        AccountLock.releaseLock(key);
      }
    }
  }
Exemplo n.º 2
0
  public void synchronize() throws PortalException, SystemException {
    if (_log.isDebugEnabled()) {
      _log.debug("Synchronizing all folders for accountId " + account.getAccountId());
    }

    updateFolders();

    List<Folder> folders = FolderLocalServiceUtil.getFolders(account.getAccountId());

    String key = AccountLock.getKey(user.getUserId(), account.getAccountId());

    if (AccountLock.acquireLock(key)) {
      try {
        for (Folder folder : folders) {
          _imapAccessor.storeEnvelopes(folder.getFolderId(), true);
        }
      } finally {
        AccountLock.releaseLock(key);
      }
    }
  }