public WebApiHost(IHttpServerFactory factory, IShutdown shutdown) { _factory = factory; _shutdown = shutdown; }
public WindowsServiceInterceptor(IWindowsServiceHandler windowsServiceHandler, IShutdown shutdown, ILogger logger) { _windowsServiceHandler = windowsServiceHandler; _shutdown = shutdown; _logger = logger; _isHostHandleSpec = new IsHostHandleSpecification(); _isWaitForShutdownRequestSpec = new IsWaitForShutdownRequestSpecification(); }
public Peer AddShutdownListener(IShutdown shutdown) { _shutdownListeners.Add(shutdown); return(this); }
public AutoUpdater( IFactory factory, MultiInstance.IInstancesCounter mutualExecutionCounter, IShutdown shutdown, ISynchronizationContext eventInvoker, Telemetry.ITelemetryCollector telemetry, Persistence.IStorageManager storage, ITraceSourceFactory traceSourceFactory, Extensibility.IPluginsManagerInternal pluginsManager, IChangeNotification changeNotification ) { this.updateDownloader = factory.CreateAppUpdateDownloader(); this.checkRequested = new TaskCompletionSource <int>(); this.factory = factory; this.pluginsManager = pluginsManager; this.trace = traceSourceFactory.CreateTraceSource("AutoUpdater"); var entryAssemblyLocation = Assembly.GetEntryAssembly()?.Location; if (entryAssemblyLocation != null) { this.managedAssembliesPath = Path.GetDirectoryName(entryAssemblyLocation); this.updateInfoFilePath = Path.Combine(managedAssembliesPath, Constants.updateInfoFileName); this.installationDir = Path.GetFullPath( Path.Combine(managedAssembliesPath, Constants.installationPathRootRelativeToManagedAssembliesLocation)); } this.eventInvoker = eventInvoker; this.telemetry = telemetry; this.storage = storage; shutdown.Cleanup += (s, e) => ((IDisposable)this).Dispose(); this.updatesStorageEntry = storage.GetEntry("updates"); bool isFirstInstance = mutualExecutionCounter.IsPrimaryInstance; bool isDownloaderConfigured = updateDownloader.IsDownloaderConfigured; if (entryAssemblyLocation == null) { trace.Info("autoupdater is disabled - no entry assembly"); isActiveAutoUpdaterInstance = false; state = AutoUpdateState.Disabled; } else if (!isDownloaderConfigured) { trace.Info("autoupdater is disabled - update downloader not configured"); isActiveAutoUpdaterInstance = false; state = AutoUpdateState.Disabled; } else if (!isFirstInstance) { trace.Info("autoupdater is deactivated - not a first instance of logjoint"); isActiveAutoUpdaterInstance = false; state = AutoUpdateState.Inactive; } else { trace.Info("autoupdater is enabled"); isActiveAutoUpdaterInstance = true; state = AutoUpdateState.Idle; workerCancellation = new CancellationTokenSource(); workerCancellationToken = workerCancellation.Token; workerCancellationTask = new TaskCompletionSource <int>(); changeListenerSubscription = changeNotification.CreateSubscription(Updaters.Create( () => pluginsManager.InstallationRequests, (_, prev) => { if (prev != null) { checkRequested.TrySetResult(1); } } )); worker = TaskUtils.StartInThreadPoolTaskScheduler(Worker); } }
public Peer AddShutdownListener(IShutdown shutdown) { _shutdownListeners.Add(shutdown); return this; }
public DbDistributedMutex(IDbFactory db, IIntegrationDatabaseConfiguration configuration, IRuntimeSettings settings, IFeatureToggler featureToggler, IShutdown shutdown) { _db = db; _configuration = configuration; _featureToggler = featureToggler; _shutdown = shutdown; if (!TimeSpan.TryParse(settings[QueryLockIntervalKey], out TimeSpan queryLockInterval)) { queryLockInterval = TimeSpan.FromSeconds(5); } _queryLockInterval = queryLockInterval; }
public HangfireHost(IHangfireServerFactory serverFactory, IShutdown shutdown) { _serverFactory = serverFactory; _shutdown = shutdown; }
public InstancesCounter(IShutdown shutdown) { isFirstInstance = Process.GetProcessesByName(processName).Length == 1; }
public Host(IStartup startup, IMonitor monitor, IConfiguration configuration, IShutdown shutdown, IComponentFactory factory, ILogger logger) { _startup = startup; _monitor = monitor; Configuration = configuration; _shutdown = shutdown; _factory = factory; _cancellationtokensource = new CancellationTokenSource(); _logger = logger; }
public void RunVoid(IShutdown shutdown, Action <string> runAfter = null) => Run(shutdown, runAfter);
public Presenter( ILogSourcesManager logSources, Preprocessing.ILogSourcesPreprocessingManager preprocessingsManager, IView view, LogViewer.IPresenter viewerPresenter, SearchResult.IPresenter searchResultPresenter, SearchPanel.IPresenter searchPanelPresenter, SourcesList.IPresenter sourcesListPresenter, SourcesManager.IPresenter sourcesManagerPresenter, MessagePropertiesDialog.IPresenter messagePropertiesDialogPresenter, LoadedMessages.IPresenter loadedMessagesPresenter, BookmarksManager.IPresenter bookmarksManagerPresenter, IHeartBeatTimer heartBeatTimer, ITabUsageTracker tabUsageTracker, StatusReports.IPresenter statusReportFactory, IDragDropHandler dragDropHandler, IPresentersFacade presentersFacade, IAutoUpdater autoUpdater, Progress.IProgressAggregator progressAggregator, IAlertPopup alerts, SharingDialog.IPresenter sharingDialogPresenter, IssueReportDialogPresenter.IPresenter issueReportDialogPresenter, IShutdown shutdown ) { this.tracer = new LJTraceSource("UI", "ui.main"); this.logSources = logSources; this.preprocessingsManager = preprocessingsManager; this.view = view; this.tabUsageTracker = tabUsageTracker; this.searchPanelPresenter = searchPanelPresenter; this.searchResultPresenter = searchResultPresenter; this.bookmarksManagerPresenter = bookmarksManagerPresenter; this.viewerPresenter = viewerPresenter; this.presentersFacade = presentersFacade; this.dragDropHandler = dragDropHandler; this.heartBeatTimer = heartBeatTimer; this.autoUpdater = autoUpdater; this.progressAggregator = progressAggregator; this.alerts = alerts; this.sharingDialogPresenter = sharingDialogPresenter; this.issueReportDialogPresenter = issueReportDialogPresenter; this.shutdown = shutdown; this.statusRepors = statusReportFactory; view.SetPresenter(this); viewerPresenter.ManualRefresh += delegate(object sender, EventArgs args) { using (tracer.NewFrame) { tracer.Info("----> User Command: Refresh"); logSources.Refresh(); } }; viewerPresenter.FocusedMessageBookmarkChanged += delegate(object sender, EventArgs args) { if (searchResultPresenter != null) { searchResultPresenter.MasterFocusedMessage = viewerPresenter.GetFocusedMessageBookmark(); } }; if (messagePropertiesDialogPresenter != null) { viewerPresenter.DefaultFocusedMessageActionCaption = "Show properties..."; viewerPresenter.DefaultFocusedMessageAction += (s, e) => { messagePropertiesDialogPresenter.ShowDialog(); }; } if (searchResultPresenter != null) { searchResultPresenter.OnClose += (sender, args) => searchPanelPresenter.CollapseSearchResultPanel(); searchResultPresenter.OnResizingStarted += (sender, args) => view.BeginSplittingSearchResults(); } sourcesListPresenter.OnBusyState += (_, evt) => SetWaitState(evt.BusyStateRequired); sourcesManagerPresenter.OnBusyState += (_, evt) => SetWaitState(evt.BusyStateRequired); searchPanelPresenter.InputFocusAbandoned += delegate(object sender, EventArgs args) { loadedMessagesPresenter.LogViewerPresenter.ReceiveInputFocus(); }; loadedMessagesPresenter.OnResizingStarted += (s, e) => view.BeginSplittingTabsPanel(); this.heartBeatTimer.OnTimer += (sender, e) => { if (e.IsRareUpdate) { SetAnalyzingIndication(logSources.Items.Any(s => s.TimeGaps.IsWorking)); } }; sourcesManagerPresenter.OnViewUpdated += (sender, evt) => { UpdateMillisecondsDisplayMode(); }; logSources.OnLogSourceAdded += (sender, evt) => { UpdateFormCaption(); }; logSources.OnLogSourceRemoved += (sender, evt) => { UpdateFormCaption(); }; if (autoUpdater != null) { autoUpdater.Changed += (sender, args) => { UpdateAutoUpdateIcon(); }; } progressAggregator.ProgressStarted += (sender, args) => { view.SetTaskbarState(TaskbarState.Progress); UpdateFormCaption(); }; progressAggregator.ProgressEnded += (sender, args) => { view.SetTaskbarState(TaskbarState.Idle); UpdateFormCaption(); }; progressAggregator.ProgressChanged += (sender, args) => { view.UpdateTaskbarProgress(args.ProgressPercentage); UpdateFormCaption(); }; if (sharingDialogPresenter != null) { sharingDialogPresenter.AvailabilityChanged += (sender, args) => { UpdateShareButton(); }; sharingDialogPresenter.IsBusyChanged += (sender, args) => { UpdateShareButton(); }; } ; UpdateFormCaption(); UpdateShareButton(); view.SetIssueReportingMenuAvailablity(issueReportDialogPresenter.IsAvailable); }
public SlackBot(ISlackBotCommand[] commands, ISlackConfiguration configuration, IShutdown shutdown) { if (!configuration.Enabled) { return; } CancellationToken token = shutdown.Token; Worker = Task.Run(() => { SlackConnector.SlackConnector connector = new SlackConnector.SlackConnector(); ISlackConnection client = connector.Connect(configuration.BotUserToken).Result; client.OnMessageReceived += message => { var context = new SlackBotCommandContext(client.Say, message); var tasks = new List <Task>(); Parallel.ForEach(commands, command => { Task task; if (command.TryHandle(context, token, out task)) { tasks.Add(task); } }); // TODO: Implement various messages - randomly selected // - also implement a "/help" command type if (tasks.Count == 0) { return(context.WriteText("Hey, you're cool, but I don't understand what you're trying to do.")); } return(Task.WhenAll(tasks)); }; token.WaitHandle.WaitOne(); client.Disconnect(); }, token); }
public FakeSlackBot(IShutdown shutdown) { _shutdown = shutdown; }
public WatchFiles(ITaskFactory factory, ITaskRunner runner, IShutdown shutdown, IConsoleWriter writer) : base(factory, runner) { _shutdown = shutdown; _writer = writer; }
public RebusHost(Func <IBus> bus, IShutdown shutdown) { _bus = bus; _shutdown = shutdown; }
public LiteServerHost(ILiteServerFactory serverFactory, IShutdown shutdown) { _serverFactory = serverFactory; _shutdown = shutdown; }
public void AddShutdown(IShutdown shutdown) { _shutdowns.Add(shutdown); }
public JobController(IShutdown shutdown, IScheduler scheduler) { memoryTarget = LogManager.Configuration.AllTargets.OfType <MemoryTarget>().FirstOrDefault(); this.scheduler = scheduler; this.shutdown = shutdown; }
public PersistentUserDataManager(ITraceSourceFactory traceSourceFactory, Implementation.IStorageManagerImplementation impl, IShutdown shutdown) { this.trace = traceSourceFactory.CreateTraceSource("Storage", "storage"); this.impl = impl; this.impl.SetTrace(trace); this.globalSettingsEntry = new Lazy <IStorageEntry>(() => impl.GetEntry("global", 0)); shutdown.Cleanup += (sender, e) => impl.Dispose(); }
public Peer RemoveShutdownListener(IShutdown shutdown) { _shutdownListeners.Remove(shutdown); return this; }
public AutoUpdater( MultiInstance.IInstancesCounter mutualExecutionCounter, IUpdateDownloader updateDownloader, ITempFilesManager tempFiles, IShutdown shutdown, IInvokeSynchronization eventInvoker, IFirstStartDetector firstStartDetector, Telemetry.ITelemetryCollector telemetry, Persistence.IStorageManager storage ) { this.mutualExecutionCounter = mutualExecutionCounter; this.updateDownloader = updateDownloader; this.tempFiles = tempFiles; this.manualCheckRequested = new TaskCompletionSource <int>(); this.firstStartDetector = firstStartDetector; this.managedAssembliesPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); this.updateInfoFilePath = Path.Combine(managedAssembliesPath, updateInfoFileName); this.installationDir = Path.GetFullPath( Path.Combine(managedAssembliesPath, installationPathRootRelativeToManagedAssembliesLocation)); this.eventInvoker = eventInvoker; this.telemetry = telemetry; this.storage = storage; shutdown.Cleanup += (s, e) => ((IDisposable)this).Dispose(); this.updatesStorageEntry = storage.GetEntry("updates"); bool isFirstInstance = mutualExecutionCounter.IsPrimaryInstance; bool isDownloaderConfigured = updateDownloader.IsDownloaderConfigured; if (!isDownloaderConfigured) { trace.Info("autoupdater is disabled - update downloader not configured"); isActiveAutoUpdaterInstance = false; state = AutoUpdateState.Disabled; } else if (!isFirstInstance) { trace.Info("autoupdater is deactivated - not a first instance of logjoint"); isActiveAutoUpdaterInstance = false; state = AutoUpdateState.Inactive; } else { trace.Info("autoupdater is enabled"); isActiveAutoUpdaterInstance = true; state = AutoUpdateState.Idle; workerCancellation = new CancellationTokenSource(); workerCancellationToken = workerCancellation.Token; workerCancellationTask = new TaskCompletionSource <int>(); worker = TaskUtils.StartInThreadPoolTaskScheduler(Worker); } }
public WatchFiles(ITaskFactory factory, ITaskRunner runner, IRuntimeSettings settings, IShutdown shutdown) : base(factory, runner) { _settings = settings; _shutdown = shutdown; }
public MandrillApiService(MandrillConfiguration.State state, IKernel kernel, IMandrillSettingsProvider configurationProvider, IShutdown shutdown) { _shutdown = shutdown; _settings = configurationProvider.Get(); _settings.Validate(); _httpClient = state.HttpMessageHandler != null ? new HttpClient(state.HttpMessageHandler(kernel)) : new HttpClient(); _httpClient.BaseAddress = _settings.BaseUrl; }
public Peer RemoveShutdownListener(IShutdown shutdown) { _shutdownListeners.Remove(shutdown); return(this); }
public ApplicationPowerManager(IShutdown shutdown, ILogger logger) { this.shutdown = shutdown; this.logger = logger; }
public SendMessageServer(IBus bus, IShutdown shutdown) { _bus = bus; _token = shutdown.Token; }
public TaskRunner(ILogger logger, IConcurrentTaskExecution concurrentTaskExecution, IShutdown shutdown, IConsoleWriter console) { _logger = logger; _concurrentTaskExecution = concurrentTaskExecution; _shutdown = shutdown; _console = console; }