Ejemplo n.º 1
0
        /// <summary>
        /// Send an exit signal to the thread.
        /// </summary>
        public void Exit()
        {
            if (IsActive)
            {
                IsActive = false;
                Log.Trace("FileSystemDataFeed.Exit(): Start. Setting cancellation token...");
                _cancellationTokenSource.Cancel();
                Log.Trace("FileSystemDataFeed.Exit(): Ending Thread...");
                _controller?.DisposeSafely();

                if (_subscriptions != null)
                {
                    // remove each subscription from our collection
                    foreach (var subscription in Subscriptions)
                    {
                        try
                        {
                            RemoveSubscription(subscription.Configuration);
                        }
                        catch (Exception err)
                        {
                            Log.Error(err, "Error removing: " + subscription.Configuration);
                        }
                    }
                }

                _subscriptionfactory?.DisposeSafely();
                Log.Trace("FileSystemDataFeed.Exit(): Exit Finished.");
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Send an exit signal to the thread.
 /// </summary>
 public void Exit()
 {
     if (IsActive)
     {
         IsActive = false;
         Log.Trace("FileSystemDataFeed.Exit(): Start. Setting cancellation token...");
         _cancellationTokenSource.Cancel();
         Log.Trace("FileSystemDataFeed.Exit(): Ending Thread...");
         _controller?.DisposeSafely();
         _subscriptionFactory?.DisposeSafely();
         Log.Trace("FileSystemDataFeed.Exit(): Exit Finished.");
     }
 }