void deleteEmptyFolder(OperationContext octxt, int folderId) throws ServiceException { lock.lock(); try { Folder folder = getFolderById(octxt, folderId); if (folder.getItemCount() != 0 || folder.hasSubfolders()) { throw OfflineServiceException.FOLDER_NOT_EMPTY(folderId); } delete(octxt, folderId, MailItem.Type.FOLDER); } catch (MailServiceException.NoSuchItemException nsie) { ZimbraLog.mailbox.info("folder already deleted, skipping: %d", folderId); } finally { lock.release(); } }