// Token: 0x06000005 RID: 5 RVA: 0x00002438 File Offset: 0x00000638
 protected override void OnStopInternal()
 {
     Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ServiceStopping, null, new object[0]);
     AssistantsService.TracerPfd.TracePfd <int>((long)this.GetHashCode(), "PFD IWS {0} Stopping the Mailbox Assistants Service", 32151);
     if (this.memoryMonitor != null)
     {
         this.memoryMonitor.Stop();
     }
     if (this.watermarkCleanupTimer != null)
     {
         this.watermarkCleanupTimer.Dispose();
     }
     if (this.databaseManager != null)
     {
         try
         {
             GrayException.MapAndReportGrayExceptions(delegate()
             {
                 this.databaseManager.Stop();
             });
         }
         catch (GrayException arg)
         {
             AssistantsService.Tracer.TraceDebug <AssistantsService, GrayException>((long)this.GetHashCode(), "{0}: Gray Exception reported during shutdown: {1}", this, arg);
         }
         finally
         {
             this.databaseManager.Dispose();
         }
         AssistantsService.TracerPfd.TracePfd <int>((long)this.GetHashCode(), "PFD IWS {0} Stopping the Assistant Infrastructure", 17815);
     }
     MailboxSearchServer.StopServer();
     AssistantsLog.LogServiceStopEvent(this.activityId);
     AssistantsLog.Stop();
     MailboxAssistantsSlaReportLogFactory.StopAll();
     using (Process currentProcess = Process.GetCurrentProcess())
     {
         Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ServiceStopped, null, new object[]
         {
             currentProcess.Id,
             "Microsoft Exchange",
             "15.00.1497.010"
         });
     }
     ProcessAccessManager.UnregisterComponent(this);
     ProcessAccessManager.UnregisterComponent(SettingOverrideSync.Instance);
     SettingOverrideSync.Instance.Stop();
     AssistantsService.TracerPfd.TracePfd <int>((long)this.GetHashCode(), "PFD IWS {0} The Mailbox Assistants Service Stopped successfully", 21911);
 }
Esempio n. 2
0
        private static void LogDatabaseSlaEvent(AssistantBase assistant, DatabaseSlaEventType eventType, Exception exception = null)
        {
            string text         = "Unknown";
            string databaseName = "Unknown";

            if (assistant != null)
            {
                databaseName = ((assistant.DatabaseInfo == null) ? "Unknown" : assistant.DatabaseInfo.DatabaseName);
                text         = assistant.NonLocalizedName;
            }
            MailboxAssistantsSlaReportLogFactory.MailboxAssistantsDatabaseSlaLog mailboxAssistantsDatabaseSlaLog = MailboxAssistantsSlaReportLogFactory.GetLogInstance(text, SlaLogType.DatabaseSlaLog) as MailboxAssistantsSlaReportLogFactory.MailboxAssistantsDatabaseSlaLog;
            if (mailboxAssistantsDatabaseSlaLog != null)
            {
                mailboxAssistantsDatabaseSlaLog.LogDatabaseEvent(text, databaseName, eventType, exception);
            }
        }
Esempio n. 3
0
        private static void LogMailboxSlaEvent(AssistantBase assistant, Guid mailboxGuid, string mailboxDisplayNameTracingOnlyUsage, TimeBasedDatabaseJob job, MailboxSlaEventType eventType, MailboxSlaFilterReasonType reason = MailboxSlaFilterReasonType.None, Exception exception = null)
        {
            string text         = "Unknown";
            string databaseName = "Unknown";
            string jobId        = string.Empty;
            MailboxSlaRequestType requestType = MailboxSlaRequestType.Unknown;

            if (assistant != null)
            {
                databaseName = ((assistant.DatabaseInfo == null) ? "Unknown" : assistant.DatabaseInfo.DatabaseName);
                text         = assistant.NonLocalizedName;
            }
            if (job != null)
            {
                jobId       = job.StartTime.ToString("O");
                requestType = ((job is TimeBasedDatabaseWindowJob) ? MailboxSlaRequestType.Scheduled : MailboxSlaRequestType.OnDemand);
            }
            MailboxAssistantsSlaReportLogFactory.MailboxAssistantsSlaReportLog logInstance = MailboxAssistantsSlaReportLogFactory.GetLogInstance(text, SlaLogType.MailboxSlaLog);
            if (logInstance != null)
            {
                logInstance.LogMailboxEvent(text, databaseName, jobId, requestType, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, eventType, reason, exception);
            }
        }
Esempio n. 4
0
        internal static void LogErrorProcessingMailboxEvent(string assistantName, MailboxData mailbox, Exception e, string databaseName = "", string jobId = "", MailboxSlaRequestType requestType = MailboxSlaRequestType.Unknown)
        {
            string value             = string.Empty;
            string value2            = "unknown";
            string value3            = "unknown";
            Guid   guid              = Guid.Empty;
            string value4            = string.Empty;
            string value5            = (e.InnerException != null) ? e.InnerException.GetType().ToString() : "null";
            string diagnosticContext = AssistantsLog.GetDiagnosticContext(e);
            Guid   activityId        = (ActivityContext.ActivityId != null) ? ActivityContext.ActivityId.Value : Guid.Empty;

            if (mailbox != null)
            {
                value3 = mailbox.DatabaseGuid.ToString();
                StoreMailboxData storeMailboxData = mailbox as StoreMailboxData;
                if (storeMailboxData != null)
                {
                    value2 = "Store";
                    guid   = storeMailboxData.Guid;
                    if (storeMailboxData.OrganizationId != null)
                    {
                        value = storeMailboxData.OrganizationId.ToString();
                    }
                }
                else
                {
                    AdminRpcMailboxData adminRpcMailboxData = mailbox as AdminRpcMailboxData;
                    if (adminRpcMailboxData != null)
                    {
                        value2 = "AdminRpc";
                        value4 = adminRpcMailboxData.MailboxNumber.ToString(CultureInfo.InvariantCulture);
                    }
                }
            }
            List <KeyValuePair <string, object> > customData = new List <KeyValuePair <string, object> >
            {
                new KeyValuePair <string, object>("MailboxType", value2),
                new KeyValuePair <string, object>("MailboxGuid", guid),
                new KeyValuePair <string, object>("MailboxId", value4),
                new KeyValuePair <string, object>("TenantId", value),
                new KeyValuePair <string, object>("Database", value3),
                new KeyValuePair <string, object>("ExceptionType", e.GetType().ToString()),
                new KeyValuePair <string, object>("InnerExceptionType", value5),
                new KeyValuePair <string, object>("DiagnosticContext", diagnosticContext)
            };

            AssistantsLog.InternalLogRow(activityId, assistantName, null, AssistantsEventType.ErrorProcessingMailbox, customData, guid);
            if (!string.IsNullOrEmpty(assistantName))
            {
                MailboxAssistantsSlaReportLogFactory.MailboxAssistantsSlaReportLog logInstance = MailboxAssistantsSlaReportLogFactory.GetLogInstance(assistantName, SlaLogType.MailboxSlaLog);
                if (logInstance != null)
                {
                    logInstance.LogMailboxEvent(assistantName, databaseName, jobId, requestType, guid, (mailbox == null) ? string.Empty : mailbox.DisplayName, MailboxSlaEventType.ErrorProcessingMailbox, MailboxSlaFilterReasonType.None, e);
                }
            }
        }