Example #1
0
        private void Worker()
        {
            while (!shutdownToken.IsCancellationRequested)
            {
                try
                {
                    var node = ioQueue.Take(shutdownToken.Token);

                    try
                    {
                        node.Run();

                        LogTo.Trace($"Node {node} finished IO");
                        if (shutdownToken.IsCancellationRequested)
                        {
                            break;
                        }
                    }
                    catch (Exception e)
                    {
                        FailNode(node, e);
                    }
                }
                catch (OperationCanceledException)
                {
                    break;
                }
            }

            LogTo.Trace("shutdownToken was cancelled, finishing work");

            workerIsDone.Set();
        }
        private void Worker()
        {
            while (!shutdownToken.IsCancellationRequested)
            {
                try
                {
                    var node = ioQueue.Take(shutdownToken.Token);

                    try
                    {
                        node.Run();
                        if (shutdownToken.IsCancellationRequested)
                        {
                            break;
                        }
                    }
                    catch (Exception e)
                    {
                        FailNode(node, e);
                    }
                }
                catch (OperationCanceledException)
                {
                    break;
                }
            }

            if (LogDebugEnabled)
            {
                log.Debug("shutdownToken was cancelled, finishing work");
            }

            workerIsDone.Set();
        }
Example #3
0
        private void Worker()
        {
            while (!shutdownToken.IsCancellationRequested)
            {
                try
                {
                    var node = ioQueue.Take(shutdownToken.Token);

                    try
                    {
                        node.Run(shutdownToken.Token);                         // this may throw

                        logger.Trace("Node {node} finished IO", node);
                        if (shutdownToken.IsCancellationRequested)
                        {
                            break;
                        }
                    }
                    catch (OperationCanceledException)
                    {
                        break;
                    }
                    catch (Exception e)
                    {
                        HandleFailedNode(node, e);
                    }
                }
                catch (OperationCanceledException)
                {
                    break;
                }
            }

            logger.Trace("shutdownToken was cancelled, finishing work");

            workerIsDone.Set();
        }