use of com.zimbra.soap.type.AccountWithModifications in project zm-mailbox by Zimbra.
the class ImapServerListener method processAdminWaitSetResponse.
private synchronized void processAdminWaitSetResponse(AdminWaitSetResponse wsResp) throws Exception {
String respWSId = wsResp.getWaitSetId();
if (wsID == null || !wsID.equalsIgnoreCase(respWSId)) {
// rogue response, which we are not interested in
ZimbraLog.imap.error("Received AdminWaitSetResponse for another waitset ", respWSId);
return;
}
if (wsResp.getCanceled() != null && wsResp.getCanceled().booleanValue() && wsID.equalsIgnoreCase(respWSId)) {
// this waitset was canceled
ZimbraLog.imap.warn("AdminWaitSet %s was cancelled", respWSId);
deleteWaitSet();
restoreWaitSet();
return;
}
String seqNum = wsResp.getSeqNo();
int modSeq = 0;
if (seqNum != null) {
modSeq = Integer.parseInt(wsResp.getSeqNo());
}
ZimbraLog.imap.debug("Received AdminWaitSetResponse for waitset %s. Updating sequence to %s", respWSId, wsResp.getSeqNo());
lastSequence.set(modSeq);
List<AccountWithModifications> signalledAccounts = wsResp.getSignalledAccounts();
if (signalledAccounts != null && signalledAccounts.size() > 0) {
Iterator<AccountWithModifications> iter = signalledAccounts.iterator();
while (iter.hasNext()) {
AccountWithModifications accInfo = iter.next();
notifyAccountChange(accInfo);
removeNotifyWhenCaughtUp(accInfo.getId(), accInfo.getLastChangeId());
}
}
cleanupCatchupToKnownLastChangeId();
// check for errors
List<IdAndType> errors = wsResp.getErrors();
if (errors != null) {
Iterator<IdAndType> iter = errors.iterator();
while (iter.hasNext()) {
IdAndType error = iter.next();
String errorType = error.getType();
String accId = error.getId();
if (errorType != null) {
ZimbraLog.imap.error("AdminWaitSetResponse returned an error for account %s. Error: %s", accId, errorType);
WaitSetError.Type err = WaitSetError.Type.valueOf(errorType);
if (err == WaitSetError.Type.NO_SUCH_ACCOUNT || err == WaitSetError.Type.MAILBOX_DELETED || err == WaitSetError.Type.MAINTENANCE_MODE || err == WaitSetError.Type.WRONG_HOST_FOR_ACCOUNT || err == WaitSetError.Type.ERROR_LOADING_MAILBOX) {
ConcurrentHashMap<Integer, Set<ImapRemoteSession>> foldersToSessions = sessionMap.get(accId);
sessionMap.remove(accId);
if (foldersToSessions != null && !foldersToSessions.isEmpty()) {
foldersToSessions.forEach((folderId, listeners) -> {
if (listeners != null) {
for (ImapRemoteSession l : listeners) {
SessionCache.clearSession(l);
}
}
});
}
}
}
}
}
if (sessionMap.isEmpty()) {
deleteWaitSet();
} else {
continueWaitSet();
}
}
Aggregations