/// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();

                // If the process has started, all three disposable objects will be valid
                // I would just call OnStop, but the code analysis tool doesn't look inside
                // it and thinks the members aren't being Disposed.
                if (Processors.Count > 0)
                {
                    // Clean up the directory watcher and crash processor threads
                    foreach (var Processor in Processors)
                    {
                        Processor.Dispose();
                    }
                    Processors.Clear();

                    Watcher.Dispose();
                    Watcher = null;

                    StatusReporter.Dispose();
                    StatusReporter = null;

                    Slack.Dispose();
                    Slack = null;

                    // Flush the log to disk
                    Log.Dispose();
                    Log = null;
                }
            }
            base.Dispose(disposing);
        }
示例#2
0
        /// <summary>
        /// Stop the service.
        /// </summary>
        protected override void OnStop()
        {
            StatusReporter.OnPreStopping();

            // Clean up the directory watcher and crash processor threads
            foreach (var Processor in Processors)
            {
                Processor.RequestStop();
            }
            foreach (var Processor in Processors)
            {
                Processor.Dispose();
            }
            Processors.Clear();

            Watcher.Dispose();
            Watcher = null;

            StatusReporter.Dispose();
            StatusReporter = null;

            Slack.Dispose();
            Slack = null;

            // Flush the log to disk
            Log.Dispose();
            Log = null;
        }
        private void OnDispose()
        {
            bDisposing = true;

            // Clean up the directory watcher and crash processor threads
            WriteEvent("Shutdown: Stopping ReportProcessors...");
            foreach (var Processor in Processors)
            {
                Processor.RequestStop();
            }
            WriteEvent("Shutdown: Disposing ReportProcessors...");
            foreach (var Processor in Processors)
            {
                Processor.Dispose();
            }
            Processors.Clear();
            WriteEvent("Shutdown: ReportProcessors stopped and disposed.");

            WriteEvent("Shutdown: Disposing ReportWatcher...");
            Watcher.Dispose();
            Watcher = null;
            WriteEvent("Shutdown: ReportWatcher disposed.");

            WriteEvent("Shutdown: Writing ReportIndex.");
            ReportIndex.WriteToFile();
            ReportIndex = null;
            WriteEvent("Shutdown: ReportIndex written.");

            WriteEvent("Shutdown: Disposing AmazonClients...");
            OutputAWS.Dispose();
            OutputAWS = null;
            DataRouterAWS.Dispose();
            DataRouterAWS = null;
            WriteEvent("Shutdown: AmazonClients disposed.");

            WriteEvent("Shutdown: Disposing StatusReporter...");
            StatusReporter.Dispose();
            StatusReporter = null;
            WriteEvent("Shutdown: StatusReporter disposed.");

            WriteEvent("Shutdown: Disposing SlackWriter...");
            Slack.Dispose();
            Slack = null;
            WriteEvent("Shutdown: SlackWriter disposed.");

            // Flush the log to disk
            WriteEvent("Shutdown: Disposing LogWriter.");
            Log.Dispose();
            Log = null;

            bDisposed = true;
        }
        private void OnDispose()
        {
            bDisposing = true;

            // Clean up the directory watcher and crash processor threads
            foreach (var Processor in Processors)
            {
                Processor.RequestStop();
            }
            foreach (var Processor in Processors)
            {
                Processor.Dispose();
            }
            Processors.Clear();

            Watcher.Dispose();
            Watcher = null;

            ReportIndex.WriteToFile();
            ReportIndex = null;

            OutputAWS.Dispose();
            OutputAWS = null;

            DataRouterAWS.Dispose();
            DataRouterAWS = null;

            StatusReporter.Dispose();
            StatusReporter = null;

            Slack.Dispose();
            Slack = null;

            // Flush the log to disk
            Log.Dispose();
            Log = null;

            bDisposed = true;
        }
示例#5
0
 public void Dispose()
 {
     m_statusReporter.Dispose();
 }