예제 #1
0
        private void ThreadWorkProc()
        {
            try
            {
                var spanList = new List <Span>();

                while (true)
                {
                    _spansEnqueuedEvent.WaitOne();

                    if (_disposed == DisposedSet)
                    {
                        _spansEnqueuedEvent.Dispose();
                        _enqueuedSpans      = null;
                        _spansEnqueuedEvent = null;
                        break;
                    }

                    Span span;
                    while (_enqueuedSpans.TryDequeue(out span))
                    {
                        spanList.Add(span);
                    }

                    try
                    {
                        _dispatcher.DispatchSpans(spanList).Wait();
                    }
                    catch (Exception ex)
                    {
                        _metrics.ErrorDispatching(ex);
                    }

                    spanList.Clear();
                }
            }
            catch (Exception ex)
            {
                _metrics.ErrorDispatching(ex);
            }
        }