use of com.zimbra.cs.mailbox.MailServiceException.MailboxInMaintenanceException in project zm-mailbox by Zimbra.
the class ImapSessionManager method closeFolder.
void closeFolder(ImapSession session, boolean isUnregistering) {
// detach session from handler and jettison session state from folder
if (session.isInteractive()) {
session.inactivate();
}
// no fancy stuff for search folders since they're always recalculated on load
if (session.isVirtual()) {
session.detach();
return;
}
// checkpoint the folder data if desired
if (SERIALIZE_ON_CLOSE) {
try {
// could use session.serialize() if we want to leave it in memory...
ZimbraLog.imap.debug("Paging session during close: %s", session);
session.unload(false);
} catch (MailboxInMaintenanceException miMe) {
if (ZimbraLog.imap.isDebugEnabled()) {
ZimbraLog.imap.info("Mailbox in maintenance detected during close - will detach %s", session, miMe);
} else {
ZimbraLog.imap.info("Mailbox in maintenance detected during close - will detach %s", session);
}
session.detach();
return;
} catch (Exception e) {
ZimbraLog.imap.warn("Skipping error while trying to serialize during close %s", session, e);
}
}
if (isUnregistering) {
return;
}
// recognize if we're not configured to allow sessions to hang around after end of SELECT
if (TERMINATE_ON_CLOSE) {
session.detach();
return;
}
// if there are still other listeners on this folder, this session is unnecessary
Mailbox mbox = session.getMailbox();
if (mbox != null) {
mbox.lock.lock();
try {
for (Session listener : mbox.getListeners(Session.Type.IMAP)) {
ImapSession i4listener = (ImapSession) listener;
if (i4listener != session && i4listener.getFolderId() == session.getFolderId()) {
ZimbraLog.imap.trace("more recent listener exists for folder. Detaching %s", session);
session.detach();
recordAccess(i4listener);
return;
}
}
} finally {
mbox.lock.release();
}
}
}
use of com.zimbra.cs.mailbox.MailServiceException.MailboxInMaintenanceException in project zm-mailbox by Zimbra.
the class ImapSessionManager method closeFolder.
protected void closeFolder(ImapListener session, boolean isUnregistering) {
// detach session from handler and jettison session state from folder
if (session.isInteractive()) {
session.inactivate();
}
// no fancy stuff for search folders since they're always recalculated on load
if (session.isVirtual()) {
session.detach();
return;
}
// checkpoint the folder data if desired
if (SERIALIZE_ON_CLOSE) {
try {
// could use session.serialize() if we want to leave it in memory...
ZimbraLog.imap.debug("Paging session during close: %s", session);
session.unload(false);
} catch (MailboxInMaintenanceException miMe) {
if (ZimbraLog.imap.isDebugEnabled()) {
ZimbraLog.imap.info("Mailbox in maintenance detected during close - will detach %s", session, miMe);
} else {
ZimbraLog.imap.info("Mailbox in maintenance detected during close - will detach %s", session);
}
session.detach();
return;
} catch (Exception e) {
ZimbraLog.imap.warn("Skipping error while trying to serialize during close %s", session, e);
}
}
if (isUnregistering) {
return;
}
// recognize if we're not configured to allow sessions to hang around after end of SELECT
if (TERMINATE_ON_CLOSE) {
session.detach();
return;
}
// if there are still other listeners on this folder, this session is unnecessary
MailboxStore mbox = session.getMailbox();
if (mbox != null) {
mbox.lock(true);
try {
for (ImapListener i4listener : session.getImapMboxStore().getListeners(session.getFolderItemIdentifier())) {
if (differentSessions(i4listener, session)) {
ZimbraLog.imap.trace("more recent listener exists for folder. Detaching %s", session);
session.detach();
recordAccess(i4listener);
return;
}
}
} finally {
mbox.unlock();
}
}
}
Aggregations