public Boolean CleanupAndWaitForAsyncSend(Int32 waitMS) { _thread?.Stop(); while (_reportActions.IsEmpty() == false) { SendReportInQueue(); } _thread = null; _reportActions = null; return(_slackWebhook.WaitForAsyncSend(waitMS)); }
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(); } }
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(); } }
private void CreateLogQueue() { _logQueue = new QueueMT <Log>(Config.MaxLogQueueSize); }