// Token: 0x060007C5 RID: 1989 RVA: 0x000387A4 File Offset: 0x000369A4 private void ThrowIfShuttingDown(MailboxSession mailboxSession, CalendarSyncLogEntry logEntry, List <KeyValuePair <string, object> > customDataToLog) { if (base.Shutdown) { CalendarSyncAssistant.Tracer.TraceDebug <object, IExchangePrincipal>((long)this.GetHashCode(), "{0}: Shutdown called during processing of mailbox '{1}'.", TraceContext.Get(), mailboxSession.MailboxOwner); Exception ex = new ShutdownException(); logEntry.ExceptionType = ex.GetType().FullName; logEntry.ProcessingEndTime = DateTime.UtcNow; logEntry.TotalProcessingTime = (long)(logEntry.ProcessingEndTime - logEntry.ProcessingStartTime).TotalMilliseconds; customDataToLog.AddRange(logEntry.LogAllData(mailboxSession, null)); throw ex; } }
// Token: 0x060007D3 RID: 2003 RVA: 0x00038C34 File Offset: 0x00036E34 public void ProcessFolder(MailboxSession mailboxSession, string parameters, CalendarSyncLogEntry logEntry) { Exception ex = null; try { StoreObjectId folderId = this.StoreObjectIdFromParameters(parameters); this.ProcessFolder(mailboxSession, folderId, logEntry); } catch (CorruptDataException ex2) { ex = ex2; } catch (FormatException ex3) { ex = ex3; } catch (ArgumentException ex4) { ex = ex4; } catch (ObjectNotFoundException ex5) { ex = ex5; } if (ex != null) { CalendarSyncAssistantHelper.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: CalendarSyncAssistantHelper.ProcessFolder with parameter {1} for mailbox {2} hit the following exception: {3}", new object[] { TraceContext.Get(), parameters, this.GetDisplayName(mailboxSession), ex }); logEntry.Exception = ex; logEntry.ExceptionType = ex.GetType().FullName; } }
// Token: 0x060007C4 RID: 1988 RVA: 0x00038530 File Offset: 0x00036730 protected override void InvokeInternal(InvokeArgs invokeArgs, List <KeyValuePair <string, object> > customDataToLog) { DateTime utcNow = DateTime.UtcNow; MailboxSession mailboxSession = invokeArgs.StoreSession as MailboxSession; if (mailboxSession == null) { return; } CalendarSyncLogEntry calendarSyncLogEntry = new CalendarSyncLogEntry { ProcessingStartTime = utcNow, IsOnDemandJob = false, MailboxGuid = mailboxSession.MailboxGuid, IsArchive = mailboxSession.MailboxOwner.MailboxInfo.IsArchive, TenantGuid = mailboxSession.MailboxOwner.MailboxInfo.OrganizationId.GetTenantGuid(), MailboxType = mailboxSession.MailboxOwner.RecipientTypeDetails }; this.ThrowIfShuttingDown(mailboxSession, calendarSyncLogEntry, customDataToLog); try { CalendarSyncAssistant.Tracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: CalendarSyncAssistant.InvokeInternal: starting to process mailbox: {1}.", TraceContext.Get(), mailboxSession.MailboxOwner.MailboxInfo.DisplayName); ExTimeZone userTimeZone = TimeZoneHelper.GetUserTimeZone(mailboxSession); if (userTimeZone != null) { mailboxSession.ExTimeZone = userTimeZone; CalendarSyncAssistant.Tracer.TraceDebug <object, ExTimeZone>((long)this.GetHashCode(), "{0}: CalendarSyncAssistant.InvokeInternal: changed session to user configuration time zone: {1}.", TraceContext.Get(), userTimeZone); } else { CalendarSyncAssistant.Tracer.TraceDebug <object, ExTimeZone>((long)this.GetHashCode(), "{0}: CalendarSyncAssistant.InvokeInternal: failed to read user configuration time zone. Use time zone:{1}.", TraceContext.Get(), mailboxSession.ExTimeZone); SharingSyncAssistantLog.LogEntry(mailboxSession, "Failed to read user configuration time zone. Use default session time zone:{0}", new object[] { mailboxSession.ExTimeZone }); } if (string.IsNullOrEmpty(invokeArgs.Parameters)) { this.CalendarSyncAssistantHelper.ProcessMailbox(mailboxSession, invokeArgs.TimePerTask, invokeArgs.ActivityId, calendarSyncLogEntry); } else { if (this.PerformanceCounters != null) { this.PerformanceCounters.OnDemandRequests.Increment(); } calendarSyncLogEntry.IsOnDemandJob = true; this.CalendarSyncAssistantHelper.ProcessFolder(mailboxSession, invokeArgs.Parameters, calendarSyncLogEntry); } CalendarSyncAssistant.Tracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: CalendarSyncAssistant.InvokeInternal: successfully processed mailbox: {1}.", TraceContext.Get(), mailboxSession.MailboxOwner.MailboxInfo.DisplayName); } catch (Exception ex) { if (ex is AIException && ex.InnerException != null) { calendarSyncLogEntry.ExceptionType = ex.InnerException.GetType().FullName; } else { calendarSyncLogEntry.ExceptionType = ex.GetType().FullName; } throw; } finally { calendarSyncLogEntry.ProcessingEndTime = DateTime.UtcNow; calendarSyncLogEntry.TotalProcessingTime = (long)(calendarSyncLogEntry.ProcessingEndTime - utcNow).TotalMilliseconds; customDataToLog.AddRange(calendarSyncLogEntry.LogAllData(mailboxSession, invokeArgs.Parameters)); } }
// Token: 0x060007D2 RID: 2002 RVA: 0x0003891C File Offset: 0x00036B1C public void ProcessMailbox(MailboxSession mailboxSession, TimeSpan maxSyncTimePerMailbox, Guid activityId, CalendarSyncLogEntry logEntry) { Dictionary <SynchronizableFolderType, List <FolderRow> > synchronizableFolderRows = this.GetSynchronizableFolderRows(mailboxSession, SynchronizableFolderType.All); List <KeyValuePair <SynchronizableFolderType, FolderRow> > list = this.ToList(synchronizableFolderRows); list.Sort(new Comparison <KeyValuePair <SynchronizableFolderType, FolderRow> >(CalendarSyncAssistantHelper.CompareFolderPairsByLastAttemptedSyncTime)); if (this.PerformanceCounters != null) { this.PerformanceCounters.AverageSubscriptionsPerMailbox.IncrementBy((long)list.Count); this.PerformanceCounters.AverageSubscriptionsPerMailboxBase.Increment(); } Deadline deadline = this.GetDeadline(maxSyncTimePerMailbox); bool flag = false; int num = 0; logEntry.MaxTimeoutValue = (long)maxSyncTimePerMailbox.TotalMilliseconds; logEntry.NumOfFoldersToSync = list.Count; foreach (KeyValuePair <SynchronizableFolderType, FolderRow> keyValuePair in list) { this.ThrowIfShuttingDown((mailboxSession != null) ? mailboxSession.MailboxOwner : null); CalendarSyncFolderOperationLogEntry calendarSyncFolderOperationLogEntry = new CalendarSyncFolderOperationLogEntry { MailboxGuid = mailboxSession.MailboxGuid, FolderId = keyValuePair.Value.FolderId.ToString(), FolderType = keyValuePair.Key.FolderTypeName, DisplayName = keyValuePair.Value.DisplayName, TenantGuid = mailboxSession.MailboxOwner.MailboxInfo.OrganizationId.GetTenantGuid(), ActivityId = activityId }; ExDateTime utcNow = ExDateTime.UtcNow; if (!keyValuePair.Key.Synchronize(mailboxSession, keyValuePair.Value, deadline, this.PerformanceCounters, calendarSyncFolderOperationLogEntry)) { CalendarSyncAssistantHelper.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: CalendarSyncAssistantHelper.ProcessMailbox: didn't finish sync'ing folder {1} with id {2} for mailbox {3}.", new object[] { TraceContext.Get(), keyValuePair.Value.DisplayName, keyValuePair.Value.FolderId, this.GetDisplayName(mailboxSession) }); } else { num++; this.UpdateTimeBasedPerfCounters(utcNow, keyValuePair.Value); calendarSyncFolderOperationLogEntry.IsSyncSuccess = true; } calendarSyncFolderOperationLogEntry.LastAttemptedSyncTime = keyValuePair.Value.LastAttemptedSyncTime; calendarSyncFolderOperationLogEntry.LastSyncSuccessTime = keyValuePair.Value.LastSuccessfulSyncTime; logEntry.AddFolderDetailLogline(calendarSyncFolderOperationLogEntry); flag = (num == list.Count); if (deadline.IsOver && !flag) { CalendarSyncAssistantHelper.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: CalendarSyncAssistantHelper.ProcessMailbox: deadline expired before sync'ing all folders for mailbox {1}. Processed {2}/{3} folders. MaxSyncTime: {4}", new object[] { TraceContext.Get(), this.GetDisplayName(mailboxSession), num, list.Count, maxSyncTimePerMailbox }); if (mailboxSession != null) { logEntry.IsDeadlineExpired = true; break; } break; } } logEntry.NumOfFoldersActuallySynced = num; this.ProcessExtendedProperties(mailboxSession, synchronizableFolderRows); if (list.Count > 0 && !flag) { throw new SyncAssistantPastDeadlineException(string.Format("Deadline expired before processing all the folders for mailbox {0}. Processed {1}/{2} folders. MaxSyncTime: {3}", new object[] { this.GetDisplayName(mailboxSession), num, list.Count, maxSyncTimePerMailbox })); } }
// Token: 0x060007E5 RID: 2021 RVA: 0x00039374 File Offset: 0x00037574 private void ProcessFolder(MailboxSession mailboxSession, StoreObjectId folderId, CalendarSyncLogEntry logEntry) { CalendarSyncAssistantHelper.Tracer.TraceDebug <object, StoreObjectId, string>((long)this.GetHashCode(), "{0}: CalendarSyncAssistantType.ProcessFolder will try to process folder {1} from mailbox {2}.", TraceContext.Get(), folderId, this.GetDisplayName(mailboxSession)); using (Folder folder = Folder.Bind(mailboxSession, folderId)) { SynchronizableFolderType synchronizableFolderType = SynchronizableFolderType.FromFolder(folder); CalendarSyncFolderOperationLogEntry calendarSyncFolderOperationLogEntry = new CalendarSyncFolderOperationLogEntry { MailboxGuid = mailboxSession.MailboxGuid, FolderId = folderId.ToString(), DisplayName = folder.DisplayName, IsOnDemandJob = true, TenantGuid = mailboxSession.MailboxOwner.MailboxInfo.OrganizationId.GetTenantGuid() }; if (synchronizableFolderType != null) { FolderRow folderRow = FolderRow.FromFolder(folder); this.ThrowIfShuttingDown((mailboxSession != null) ? mailboxSession.MailboxOwner : null); if (!synchronizableFolderType.Synchronize(mailboxSession, folderRow, this.GetDeadline(SynchronizableFolderType.MaxSyncTimePerFolder), this.PerformanceCounters, calendarSyncFolderOperationLogEntry)) { CalendarSyncAssistantHelper.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: CalendarSyncAssistantHelper.ProcessFolder: deadline expired while processing folder {1} from mailbox {2}. MaxSyncTime {3}.", new object[] { TraceContext.Get(), folderId, this.GetDisplayName(mailboxSession), SynchronizableFolderType.MaxSyncTimePerFolder }); calendarSyncFolderOperationLogEntry.IsDeadlineExpired = true; } else { calendarSyncFolderOperationLogEntry.IsSyncSuccess = true; } calendarSyncFolderOperationLogEntry.FolderType = synchronizableFolderType.FolderTypeName; } else { CalendarSyncAssistantHelper.Tracer.TraceDebug <object, string, StoreObjectId>((long)this.GetHashCode(), "{0}: CalendarSyncAssistantHelper.ProcessFolder for mailbox {1}: id {2}. Couldn't find a corresponding SynchronizableFolderType object.", TraceContext.Get(), this.GetDisplayName(mailboxSession), folderId); calendarSyncFolderOperationLogEntry.FolderType = "UnknownFolderType"; } logEntry.AddFolderDetailLogline(calendarSyncFolderOperationLogEntry); } }