private void CreateAndStartLoggerThread() { for (Int32 i = 0; i < Config.WorkThreadCount; ++i) { var thread = new NaiveLoopThread(Tick, Config.WorkThreadIntervalMS, e => ErrorCounter.RaiseError(e), $"{nameof(Tick)}:{i}"); _loggerThreads.Add(thread); thread.Start(); } }
public void 데드락_유발_루프_안에서_Stop호출() { _naiveLoopThread = new NaiveLoopThread(Loop_2, 1000, Console.WriteLine, nameof(데드락_유발_루프_안에서_Stop호출)); _naiveLoopThread.Start(); while (_loopCount <= 0) { Console.WriteLine("wait for test..."); Thread.Sleep(500); } Console.WriteLine("test ok."); }
public void 데드락_유발_사용하는_쪽에서_Loop와_Stop에_락() { _naiveLoopThread = new NaiveLoopThread(Loop_1, 1000, Console.WriteLine, nameof(데드락_유발_사용하는_쪽에서_Loop와_Stop에_락)); _naiveLoopThread.Start(); Stop_1(); while (_loopCount <= 0) { Console.WriteLine("wait for test..."); Thread.Sleep(500); } Console.WriteLine("test ok."); }
internal void Start() { lock (_lock) { if (_thread != null) { throw new LoggerException($"Fail {nameof(CompletePutNotifier)}::{nameof(Start)} ${nameof(_thread)} is not null"); } _completePuts = new QueueMT <CompletePutNotice>(); _thread = new NaiveLoopThread(HandleCompletePut, _config.CompletePutIntervalMS, e => _errorCounter.RaiseError(e), nameof(CompletePutNotifier)); _thread.Start(); } }
internal void Start() { lock (_lock) { if (_mainThread != null || _recordLogQueueThread != null) { throw new LoggerException($"Fail {nameof(Watcher)}::{nameof(Start)}"); } _mainThread = new NaiveLoopThread(() => Watching(DateTime.UtcNow), _logger.Config.Watchers.IntervalMS, e => _logger.ErrorCounter.RaiseError(e), $"{nameof(Watcher)}-Watching"); _recordLogQueueThread = new NaiveLoopThread(RecordLogQueue, QUEUE_SIZE_RECORD_INTERVAL_MS, e => _logger.ErrorCounter.RaiseError(e), $"{nameof(Watcher)}-Record"); _mainThread.Start(); _recordLogQueueThread.Start(); } }
public SlackReporter(ReportLevelType reportLevel, String webhookURL, String userName, String channelDebug, String channelInfo, String channelWarn, String channelError, String channelFatal, String iconEmoji = null, Int32 addUTCHour = 0, Boolean tryOrderingReport = false) : base(ReporterType.Slack, reportLevel) { if (String.IsNullOrEmpty(webhookURL)) { _slackWebhook = null; } else { _channelDebug = channelDebug; _channelInfo = channelInfo; _channelWarn = channelWarn; _channelError = channelError; _channelFatal = channelFatal; _slackWebhook = new SlackWebhook(webhookURL, _channelDebug, userName, iconEmoji, addUTCHour); _tryOrderingReport = tryOrderingReport; if (_tryOrderingReport) { _thread = new NaiveLoopThread(SendReportInQueue, THREAD_INTERVAL_MS, null, nameof(SlackReporter)); _reportActions = new QueueMT <Action>(); _thread.Start(); } else { _thread = null; _reportActions = null; } } }
internal void Start() { lock (_lock) { if (_thread != null) { throw new LoggerException($"Fail {nameof(ThroughputController)}::{nameof(Start)} {nameof(_thread)} is not null"); } _putLogs = new QueueMT <PutLog>(); _remainPutLogs = new List <PutLog>(); _isThrottling = false; // 샤드가 최소 1개는 존재할 것이므로 1개 기준으로 초기화. _shardCount = 1; _byteCapacity = Const.BYTE_FOR_SECOND_PER_SHARD_BYTE; _recordCapacity = Const.RECORD_FOR_SECOND_PER_SHARD_COUNT; _thread = new NaiveLoopThread(() => ThroughputControl(DateTime.UtcNow), THROUGHPUT_CONTROL_MS, e => _errorCounter.RaiseError(e), nameof(ThroughputController)); _thread.Start(); } }