コード例 #1
0
        private void ExecutePipeLineStep(IPipelineStep pipelineStep, PropertyBag propertyBag)
        {
            try
            {
                Stopwatch sw = Stopwatch.StartNew();
                m_Logger.Debug("Executing pipeline step {0}", pipelineStep.GetType().Name);
                if (pipelineStep is IPipelineStepWithTimeout)
                {
                    IPipelineStepWithTimeout stepWithTimeout = (IPipelineStepWithTimeout)pipelineStep;
                    m_Logger.Debug("Running pipeline step {0} with timeout {1}",
                                   pipelineStep.GetType().Name, stepWithTimeout.ProcessorTimeout);
                    m_TaskRunner.RunSync(cancelArgs =>
                    {
                        if (!cancelArgs.Cancel)
                        {
                            pipelineStep.Process(this, propertyBag);
                        }
                    }, stepWithTimeout.ProcessorTimeout);
                }
                else
                {
                    pipelineStep.Process(this, propertyBag);
                }

                m_Logger.Debug("Executed pipeline step {0} in {1}", pipelineStep.GetType().Name, sw.Elapsed);
            }
            catch (Exception ex)
            {
                OnProcessorException(propertyBag, ex);
            }
        }
コード例 #2
0
ファイル: Crawler.cs プロジェクト: bormaxi/NCrawler
 private void ExecutePipeLineStep(IPipelineStep pipelineStep, PropertyBag propertyBag)
 {
     try
     {
         if (pipelineStep is IPipelineStepWithTimeout)
         {
             IPipelineStepWithTimeout stepWithTimeout = (IPipelineStepWithTimeout)pipelineStep;
             m_Logger.Debug("Running pipeline step {0} with timeout {1}",
                            pipelineStep.GetType().Name, stepWithTimeout.ProcessorTimeout);
             m_TaskRunner.RunSync(() => pipelineStep.Process(this, propertyBag), stepWithTimeout.ProcessorTimeout);
         }
         else
         {
             m_Logger.Debug("Running pipeline step {0}", pipelineStep.GetType().Name);
             pipelineStep.Process(this, propertyBag);
         }
     }
     catch (Exception ex)
     {
         OnProcessorException(propertyBag, ex);
     }
 }