Beispiel #1
0
        public override void Next(IHandlerContext context)
        {
            try
            {
                lock (this)
                {
                    if (PipelineState.Running == State ||
                        PipelineState.Unstarted == State
                        )
                    {
                        if (DefaultExecutor.InLoop)
                        {
                            var handler = context.Next();

                            var pipelineState = PipelineState;
                            if (handler == null && !(pipelineState == PipelineState.Canceled || pipelineState == PipelineState.Completed || pipelineState == PipelineState.Exception))
                            {
                                Completed();
                                return;
                            }
                            handler.Handle(DefaultExecutor);
                        }
                        else
                        {
                            DefaultExecutor.Execute(() =>
                            {
                                var handler       = context.Next();
                                var pipelineState = PipelineState;
                                if (handler == null && !(pipelineState == PipelineState.Canceled || pipelineState == PipelineState.Completed || pipelineState == PipelineState.Exception))
                                {
                                    Completed();
                                    return;
                                }
                                handler.Handle(DefaultExecutor);
                            });
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionCaught(ex);
            }
        }
Beispiel #2
0
 public override void Next(IHandlerContext context)
 {
     lock (this)
     {
         if (PipelineState.Running == State ||
             PipelineState.Unstarted == State
             )
         {
             if (DefaultExecutor.InLoop)
             {
                 DefaultExecutor.Execute(() =>
                 {
                     var handler = context.Next();
                     handler.Handle();
                 });
             }
             else
             {
                 var handler = context.Next();
                 handler.Handle();
             }
         }
     }
 }