/// <summary> /// Stops the service immediately, terminating any user activity. /// </summary> public void Stop() { lock (syncLock) { if (state == ServiceState.Stopped) { return; } SysLog.LogInformation("Authentication Service Stop"); SysLog.Flush(); base.Close(); state = ServiceState.Stopped; if (handler != null) { handler.Stop(); handler = null; } if (router != null) { router.Stop(); router = null; } Program.PerfCounters.Zero(); } }
/// <summary> /// Stops the service immediately, terminating any user activity. /// </summary> public void Stop() { lock (syncLock) { if (state == ServiceState.Stopped) { return; } SysLog.LogInformation("GeoTracker Service Stop"); SysLog.Flush(); base.Close(); state = ServiceState.Stopped; } if (node != null) { node.Stop(); node = null; } if (router != null) { router.Stop(); router = null; } Program.PerfCounters.Zero(); }
public void FlightRecorder_PassThru_SysLogProvider() { // Verify that the ISysLogProvider implementation works. Queue <FlightEvent> queue = new Queue <FlightEvent>(); ISysLogProvider orgProvider = SysLog.LogProvider; try { FlightEvent flightEvent; using (var recorder = new FlightRecorder(evt => queue.Enqueue(evt))) { SysLog.LogProvider = recorder; SysLog.LogError("Test Error"); SysLog.LogWarning("Test Warning"); SysLog.LogInformation("Test Information"); SysLog.Flush(); Assert.AreEqual(3, queue.Count); flightEvent = queue.Dequeue(); Assert.AreEqual("SysLog:Error", flightEvent.Operation); Assert.IsTrue(flightEvent.Details.Contains("Test Error")); Assert.IsTrue(flightEvent.IsError); flightEvent = queue.Dequeue(); Assert.AreEqual("SysLog:Warning", flightEvent.Operation); Assert.IsTrue(flightEvent.Details.Contains("Test Warning")); Assert.IsFalse(flightEvent.IsError); flightEvent = queue.Dequeue(); Assert.AreEqual("SysLog:Information", flightEvent.Operation); Assert.IsTrue(flightEvent.Details.Contains("Test Information")); Assert.IsFalse(flightEvent.IsError); // Verify that system events actually serialize exception // and stack trace related information. try { throw new AssertException(); } catch (Exception e) { SysLog.LogException(e); SysLog.Flush(); flightEvent = queue.Dequeue(); Assert.AreEqual("SysLog:Exception", flightEvent.Operation); Assert.IsTrue(flightEvent.Details.Contains("AssertException")); } } } finally { SysLog.LogProvider = orgProvider; } }
/// <summary> /// Stops the service immediately, terminating any user activity. /// </summary> public void Stop() { lock (syncLock) { if (state == ServiceState.Stopped) { return; } SysLog.LogInformation("Dynamic DNS Client Stop"); SysLog.Flush(); base.Close(); state = ServiceState.Stopped; } if (router != null) { client.Close(); client = null; router.Stop(); router = null; } Program.PerfCounters.Zero(); }
/// <summary> /// Handles the UI timer events. /// </summary> /// <param name="state"></param> /// <param name="status"></param> private void OnUITimer(ServiceState state, string status) { bool enableStart = false; bool enableStop = false; bool enableShutdown = false; SetStatus(state.ToString()); switch (state) { case ServiceState.Stopped: enableStart = true; SysLog.Flush(); break; case ServiceState.Running: enableStop = true; enableShutdown = true; break; case ServiceState.Shutdown: enableStop = true; break; } startButton.Enabled = enableStart; stopButton.Enabled = enableStop; shutDownButton.Enabled = enableShutdown; displayStatus.Text = status; }
/// <summary> /// Stops the service immediately, terminating any user activity. /// </summary> public void Stop() { lock (syncLock) { if (state == ServiceState.Stopped) { return; } SysLog.LogInformation("Config Service Stop"); SysLog.Flush(); base.Close(); state = ServiceState.Stopped; if (router != null) { handler.Stop(); handler = null; router.Stop(); router = null; } } }
/// <summary> /// Stops the service immediately, terminating any user activity. /// </summary> public void Stop() { lock (syncLock) { if (state == ServiceState.Stopped) { return; } SysLog.LogInformation("NeonSwitch Stop"); SysLog.Flush(); base.Close(); state = ServiceState.Stopped; if (bkTimer != null) { bkTimer.Dispose(); bkTimer = null; } if (router != null) { router.Stop(); router = null; } } }
/// <summary> /// Stop this service. /// </summary> protected override void OnStop() { try { service.Stop(); SysLog.Flush(); } catch (Exception e) { SysLog.LogException(e); } }
/// <summary> /// Stops the service immediately, terminating any user activity. /// </summary> public void Stop() { lock (syncLock) { if (state == ServiceState.Stopped) { return; } SysLog.LogInformation("Broadcast Server Stop"); SysLog.Flush(); base.Close(); state = ServiceState.Stopped; if (udpServer != null) { udpServer.Close(); udpServer = null; } Program.PerfCounters.Zero(); } }
/// <summary> /// Waits for the service to stop. /// </summary> /// <remarks> /// In real life, this will never return since the ServiceBase /// kills the process when it receives a stop command from a /// ServiceControl instance. /// </remarks> public void WaitForStop() { SysLog.Flush(); Helper.WaitFor(() => service.State == ServiceState.Stopped, TimeSpan.FromMinutes(1)); }