private async Task RunAsyncInternal() { var stopwatch = Stopwatch.StartNew(); try { _container.RegisterSingleton <IController>(() => this); _container.RegisterServices(); _options.ContainerConfigurator?.ConfigureContainer(_container); _container.Verify(); _log = _container.GetInstance <ILogService>().CreatePublisher(nameof(Controller)); _container.GetInstance <IInterruptMonitorService>().RegisterInterrupts(); _container.GetInstance <IDeviceRegistryService>().RegisterDevices(); _container.GetInstance <IRemoteSocketService>().RegisterRemoteSockets(); _container.StartupServices(_log); _container.ExposeRegistrationsToApi(); await TryConfigureAsync(); StartupCompleted?.Invoke(this, new StartupCompletedEventArgs(stopwatch.Elapsed)); _container.GetInstance <IScriptingService>().TryExecuteStartupScripts(); } catch (Exception exception) { StartupFailed?.Invoke(this, new StartupFailedEventArgs(stopwatch.Elapsed, exception)); _deferral?.Complete(); } }
public void OnStartupCompleted() { _systemStatusService.Set("startup.duration", DateTime.Now - _creationTimestamp); PublishBootedNotification(); StartupCompleted?.Invoke(this, EventArgs.Empty); _logger.LogInformation("Startup completed."); }
private void OnStartupCompleted(SwApplication app) { try { StartupCompleted?.Invoke(this); } catch (Exception ex) { Logger.Log(ex); } }
private void Startup() { try { var stopwatch = Stopwatch.StartNew(); RegisterServices(); StartHttpServer(); _container.StartupServices(_log); _container.ExposeRegistrationsToApi(); TryConfigure(); StartupCompleted?.Invoke(this, EventArgs.Empty); stopwatch.Stop(); _container.GetInstance <IApiDispatcherService>().ConfigurationRequested += (s, e) => { var controllerSettings = _container.GetInstance <ISettingsService>().GetSettings <ControllerSettings>(); e.ApiContext.Result["Controller"] = JObject.FromObject(controllerSettings); }; _log.Info("Startup completed after " + stopwatch.Elapsed); _container.GetInstance <ISystemInformationService>().Set("Health/StartupDuration", stopwatch.Elapsed); _container.GetInstance <ISystemInformationService>().Set("Health/StartupTimestamp", _container.GetInstance <IDateTimeService>().Now); _container.GetInstance <ITimerService>().Run(); } catch (Exception exception) { _log?.Error(exception, "Failed to initialize."); StartupFailed?.Invoke(this, EventArgs.Empty); } finally { Shutdown?.Invoke(this, EventArgs.Empty); _deferral?.Complete(); } }
private void Startup() { try { var stopwatch = Stopwatch.StartNew(); SetupLogger(); Log.Info("Starting..."); RegisterServices(); TryConfigure(); StartupServices(); ExposeRegistrationsToApi(); StartHttpServer(); StartupCompleted?.Invoke(this, EventArgs.Empty); stopwatch.Stop(); Log.Info("Startup completed after " + stopwatch.Elapsed); _container.GetInstance <ISystemInformationService>().Set("Health/StartupDuration", stopwatch.Elapsed); _container.GetInstance <ISystemInformationService>().Set("Health/StartupTimestamp", _container.GetInstance <IDateTimeService>().Now); _container.GetInstance <ITimerService>().Run(); } catch (Exception exception) { Log.Error(exception, "Failed to initialize."); StartupFailed?.Invoke(this, EventArgs.Empty); } finally { Shutdown?.Invoke(this, EventArgs.Empty); _deferral?.Complete(); } }
private void OnStartupCompleted(object sender, EventArgs eventArgs) { _notificationService.CreateInformation(SystemEventNotification.Booted); StartupCompleted?.Invoke(this, EventArgs.Empty); }
private void OnStartupCompleted(SwApplication app) { m_Application.FirstStartupCompleted -= OnStartupCompleted; StartupCompleted?.Invoke(this); }
public void RaiseStartupCompleted() { StartupCompleted?.Invoke(this, new StartupCompletedEventArgs(TimeSpan.Zero)); }