예제 #1
0
        public void Start(ITailStreamListener streamListener, ITailStreamContext streamContext)
        {
            lock (_lock)
            {
                // Create the thread.
                var id = Interlocked.Increment(ref _counter);

                // Notify about a new thread.
                _eventAggregator.Publish(new StartedListeningEvent(id, streamContext.GetDescription(), streamContext.GetName()));

                // Initialize the listener.
                streamListener.Initialize(streamContext);

                // Create the thread.
                var callback = new TailListenerThreadCallback(id, Publish);
                var thread   = new TailListenerThread(id, callback, streamListener, streamContext);
                thread.Start();

                _logger.Information("Created thread with id #{0} ({1}).", id, streamContext.GetDescription());

                // Add the thread to the collection.
                _threads.Add(thread);
            }
        }
예제 #2
0
        public void Start(ITailStreamListener streamListener, ITailStreamContext streamContext)
        {
            lock (_lock)
            {
                // Create the thread.
                var id = Interlocked.Increment(ref _counter);

                // Notify about a new thread.
                _eventAggregator.Publish(new StartedListeningEvent(id, streamContext.GetDescription(), streamContext.GetName()));

                // Initialize the listener.
                streamListener.Initialize(streamContext);

                // Create the thread.
                var callback = new TailListenerThreadCallback(id, Publish);
                var thread = new TailListenerThread(id, callback, streamListener, streamContext);
                thread.Start();

                _logger.Information("Created thread with id #{0} ({1}).", id, streamContext.GetDescription());

                // Add the thread to the collection.
                _threads.Add(thread);
            }
        }