public static IDisposable Use(IDaemon daemon) { if (daemon == null) throw new ArgumentNullException("daemon"); if(_currentStack == null) _currentStack = new Stack<IDaemon>(); _currentStack.Push(daemon); return UseDisposer.Instance; }
public void TestSetup() { factory = Substitute.For <IStreamStateFactory>(); factory.Create(Arg.Any <string>()).Returns(_ => state); state = Substitute.For <IStreamState>(); state.BufferPool.Returns(_ => pool); state.Statistics.Returns(_ => stats); state.RecordWriter.Returns(_ => writer); state.SendSignal.Returns(new AsyncManualResetEvent(false)); buffer = Substitute.For <IBuffer>(); writer = Substitute.For <IRecordWriter>(); stats = Substitute.For <IStatisticsCollector>(); daemon = Substitute.For <IDaemon>(); pool = Substitute.For <IBufferPool>(); pool.TryAcquire(out _) .Returns( info => { info[0] = buffer; return(true); }); log = new SynchronousConsoleLog(); sink = new HerculesSink(factory, daemon, log); }
public AsyncProjectionsService(IDocumentStore store) { daemon = store.BuildProjectionDaemon(settings: new DaemonSettings { LeadingEdgeBuffer = 0.Seconds() }); }
/// <summary> /// This method provides a <see cref="IDaemonStageProcess"/> instance which is assigned to highlighting a single document. /// </summary> /// <param name="process"> /// Current Daemon Process. /// </param> /// <param name="settingsStore"> /// The settingsStore store to use. /// </param> /// <param name="processKind"> /// The process kind. /// </param> /// <param name="file"> /// The file to analyze. /// </param> /// /// /// <returns> /// The current <see cref="IDaemonStageProcess"/>. /// </returns> protected override IDaemonStageProcess CreateProcess( IDaemonProcess process, IContextBoundSettingsStore settingsStore, DaemonProcessKind processKind, ICSharpFile file) { StyleCopTrace.In(process, settingsStore, processKind, file); if (process == null) { throw new ArgumentNullException("process"); } try { if (processKind == DaemonProcessKind.OTHER) { StyleCopTrace.Info("ProcessKind Other."); StyleCopTrace.Out(); return(null); } if (!this.IsAnalysisEnabled(settingsStore, file)) { StyleCopTrace.Info("Analysis disabled."); StyleCopTrace.Out(); return(null); } if (!this.IsSupported(process.SourceFile)) { StyleCopTrace.Info("File type not supported."); StyleCopTrace.Out(); return(null); } if (!this.FileIsValid(file)) { StyleCopTrace.Info("Source file not valid."); StyleCopTrace.Out(); return(null); } if (!settingsStore.GetValue <StyleCopOptionsSettingsKey, bool>(key => key.AnalyzeReadOnlyFiles)) { if (process.SourceFile.Properties.IsNonUserFile) { StyleCopTrace.Info("Not analysing non user files."); StyleCopTrace.Out(); return(null); } } IDaemon daemon = file.GetSolution().GetComponent <IDaemon>(); return(StyleCopTrace.Out(new StyleCopStageProcess(this.lifetime, this.apiPool, daemon, process, this.threading, file))); } catch (JetBrains.Application.Progress.ProcessCancelledException) { return(null); } }
public CommandSet() { _resetEvent = new ManualResetEvent(false); _logger = new SimpleLogger(); _daemon = new MyDaemon(_logger, _resetEvent); var config = new WindowsServiceConfiguration("aa1") { CommandLineArguments = "windows-service --start" }; _service = new WindowsService(_daemon, config); }
/// <summary> /// When daemon is not initialized, the DefaultDaemon is used. /// </summary> public static IDaemon GetDaemon() { lock (m_lock) { if (s_daemon == null) s_daemon = new DefaultDaemon(); } return s_daemon; }
public assert_if_daemon_is_running_on_wait_methods() { StoreOptions(_ => { _.Events.AsyncProjections.AggregateStreamsWith <ActiveProject>(); _.Events.AsyncProjections.TransformEvents(new CommitViewTransform()); }); theDaemon = theStore.BuildProjectionDaemon(); }
public assert_if_daemon_is_running_on_wait_methods(DefaultStoreFixture fixture) : base(fixture) { StoreOptions(_ => { _.Events.V4Projections.AsyncSelfAggregate <ActiveProject>(); _.Events.V4Projections.Async(new CommitViewTransform()); }); theDaemon = theStore.BuildProjectionDaemon(); }
private void TcpProcess(IDaemon daemon, LowLevelTcpConnection connection) { Buffer buffer = new Buffer() { Segment = new ArraySegment <byte>(new byte[2048]) }; ReadOne(buffer, connection); }
private static void Increment(IDaemon daemon, int i) { _countArray[i]++; if (_countArray[i] != _messagesPerProcess) { daemon.Schedule(() => Increment(daemon, i)); return; } if(Interlocked.Decrement(ref _countDown) == 0) Console.WriteLine("Time: {0}", (DateTime.UtcNow - _start)); }
/// <summary> /// When daemon is not initialized, the DefaultDaemon is used. /// </summary> public static IDaemon GetDaemon() { lock (m_lock) { if (s_daemon == null) { s_daemon = new DefaultDaemon(); } } return(s_daemon); }
public DaemonData(Lifetime lifetime, IThreading threading, IDaemon daemon, IDocument document) { this.lastCalledTimestamp = DateTime.MinValue; this.groupingEvent = threading.GroupingEvents.CreateEvent( lifetime, "StyleCop::ReHighlight", PauseDuration, Rgc.Guarded, () => ReadLockCookie.Execute(() => daemon.ForceReHighlight(document))); }
/// <summary> /// Initializes a new instance of the StyleCopStageProcess class, using the specified <see cref="IDaemonProcess"/> . /// </summary> /// <param name="lifetime"> /// The <see cref="Lifetime"/> of the owning <see cref="IDaemonProcess"/> /// </param> /// <param name="apiPool"> /// A reference to the StyleCop runner. /// </param> /// <param name="daemon"> /// A reference to the <see cref="IDaemon"/> manager. /// </param> /// <param name="daemonProcess"> /// <see cref="IDaemonProcess"/> to execute within. /// </param> /// <param name="threading"> /// A reference to the <see cref="IThreading"/> instance for timed actions. /// </param> /// <param name="file"> /// The file to analyze. /// </param> public StyleCopStageProcess(Lifetime lifetime, StyleCopApiPool apiPool, IDaemon daemon, IDaemonProcess daemonProcess, IThreading threading, ICSharpFile file) { StyleCopTrace.In(daemonProcess, file); this.lifetime = lifetime; this.apiPool = apiPool; this.daemon = daemon; this.daemonProcess = daemonProcess; this.threading = threading; this.file = file; StyleCopTrace.Out(); }
public static IDisposable Use(IDaemon daemon) { if (daemon == null) { throw new ArgumentNullException("daemon"); } if (_currentStack == null) { _currentStack = new Stack <IDaemon>(); } _currentStack.Push(daemon); return(UseDisposer.Instance); }
private static async Task RunDaemonAsync(IDaemon daemon) { var task = daemon.RunAsync(); AppDomain.CurrentDomain.ProcessExit += async(object?sender, EventArgs e) => { daemon.Stop(); await task; }; await task; }
private static void Increment(IDaemon daemon, int i) { _countArray[i]++; if (_countArray[i] != _messagesPerProcess) { daemon.Schedule(() => Increment(daemon, i)); return; } if (Interlocked.Decrement(ref _countDown) == 0) { Console.WriteLine("Time: {0}", (DateTime.UtcNow - _start)); } }
public static bool InitTypeLibResourceManager(IDaemon daemon) { bool success = false; lock (m_lock) { if (s_daemon == null) { s_daemon = daemon; success = true; } } return success; }
public static bool InitTypeLibResourceManager(IDaemon daemon) { bool success = false; lock (m_lock) { if (s_daemon == null) { s_daemon = daemon; success = true; } } return(success); }
public WindowsService(IDaemon daemon, IWindowsServiceConfiguration configuration) { if (configuration == null) throw new ArgumentNullException("configuration"); if (configuration.ServiceName == null) throw new ArgumentNullException("configuration", "ServiceName cannot be null"); _daemon = daemon; _configuration = configuration; EventLog.Log = "Application"; ServiceName = _configuration.ServiceName; CanStop = true; CanShutdown = true; }
public Task StartAsync(CancellationToken cancellationToken) { Logger.Information("Projections starting"); var settings = new DaemonSettings { FetchingCooldown = 500.Milliseconds(), LeadingEdgeBuffer = 100.Milliseconds() }; _daemon = _store.BuildProjectionDaemon( logger: new SerilogDaemonLogger(), settings: settings ); _daemon.StartAll(); return(Task.CompletedTask); }
public WindowsService(IDaemon daemon, IWindowsServiceConfiguration configuration) { if (configuration == null) { throw new ArgumentNullException("configuration"); } if (configuration.ServiceName == null) { throw new ArgumentNullException("configuration", "ServiceName cannot be null"); } _daemon = daemon; _configuration = configuration; EventLog.Log = "Application"; ServiceName = _configuration.ServiceName; CanStop = true; CanShutdown = true; }
internal HerculesSink(IStreamStateFactory streamStateFactory, IDaemon daemon, ILog log) { state = new State(streamStateFactory, daemon, log, new ConcurrentDictionary <string, Lazy <IStreamState> >()); }
public InvalidateOnSettingsChange(Lifetime lifetime, IDaemon daemon, ISettingsStore settingsStore) { var settingsKey = settingsStore.Schema.GetKey <CleanCodeSettings>(); settingsStore.AdviseChange(lifetime, settingsKey, daemon.Invalidate); }
public void Initialize(IReactor reactor, IDaemon daemon) { reactor.Daemon = daemon; daemon.Schedule(reactor.Initialize); }
private static void InvalidateDaemon(ISolution solution) { IDaemon component = solution.TryGetComponent <IDaemon>(); component?.Invalidate(); }
public WindowsService(string serviceName, IDaemon daemon, Action<WindowsServiceConfiguration> configure) : this(daemon, SetConfiguration(serviceName, configure)) { }
public LowLevelTcpConnection(TcpClient client, IDaemon daemon) { _client = client; _daemon = daemon; _stream = _client.GetStream(); }
public InvalidateOnSettingsChange(Lifetime lifetime, IDaemon daemon, ISettingsStore settingsStore) { var settingsKey = settingsStore.Schema.GetKey<CleanCodeSettings>(); settingsStore.AdviseChange(lifetime, settingsKey, daemon.Invalidate); }
public DaemonErrorHandler(IDaemon daemon, IDaemonLogger logger, ExceptionHandling handling) { _daemon = daemon; _logger = logger; _handling = handling; }
public ComplexityAnalysisInvalidateOnThresholdChange(Lifetime lifetime, IDaemon daemon, ISettingsStore settingsStore) { var settingsKey = settingsStore.Schema.GetKey<CyclomaticComplexityAnalysisSettings>(); settingsStore.AdviseChange(lifetime, settingsKey, daemon.Invalidate); }
public ComplexityAnalysisInvalidateOnThresholdChange(Lifetime lifetime, IDaemon daemon, ISettingsStore settingsStore) { var settingsKey = settingsStore.Schema.GetKey <CyclomaticComplexityAnalysisSettings>(); settingsStore.AdviseChange(lifetime, settingsKey, daemon.Invalidate); }
public WindowsService(string serviceName, IDaemon daemon) : this(daemon, new WindowsServiceConfiguration(serviceName)) { }
public ComplexityAnalysisInvalidateOnThresholdChange(Lifetime lifetime, IDaemon daemon, ISettingsStore settingsStore) { SettingsScalarEntry thresholdEntry = settingsStore.Schema.GetScalarEntry((ComplexityAnalysisSettings s) => s.Threshold); settingsStore.AdviseChange(lifetime, thresholdEntry, daemon.Invalidate); }
public void RemoveDaemon(IDaemon daemon) { lock (syncRoot) daemons.Remove(daemon); }
private void TcpProcess(IDaemon daemon, LowLevelTcpConnection connection) { Buffer buffer = new Buffer() { Segment = new ArraySegment<byte>(new byte[2048]) }; ReadOne(buffer, connection); }
public void RegisterDaemon(IDaemon daemon) { lock (syncRoot) daemons.Add(daemon); }