private void OnExecuted(ExecutedEventArgs e)
 {
     if (Executed != null)
     {
         Executed(this, e);
     }
 }
        /// <summary>
        /// 干活
        /// </summary>
        private void Run()
        {
            try
            {
                while (true)
                {
                    if (!IsRuning)
                    {
                        return;
                    }
                    if (IsSleeping)
                    {
                        OnWaked(new EventArgs());
                    }

                    IList <MessageEntity>  toExecutes  = this.Ontology.MessageProvider.GetTopNCommands(MessageTypeKind.Received, this.Ontology, this.Ontology.Ontology.ExecutorLoadCount, "CreateOn", "asc");;
                    IList <MessageContext> descriptors = new List <MessageContext>();
                    if (toExecutes == null || toExecutes.Count == 0)
                    {
                        Sleep(new SleepingEventArgs(this.Ontology.Ontology.ExecutorSleepTimeSpan));
                        continue;
                    }
                    else
                    {
                        foreach (var item in toExecutes)
                        {
                            var context = new MessageContext(this.Process.AcDomain, item);
                            var eArgs   = new ExecutedEventArgs(context);
                            OnExecuting(eArgs);
                            MessageHandler.Instance.Response(context);
                            if (context.Result.Status == (int)Status.ExecuteOk)
                            {
                                SucessCount++;
                            }
                            else
                            {
                                FailCount++;
                            }

                            eArgs.ExecutedOn = DateTime.Now;
                            OnExecuted(eArgs);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                OnError(new ExceptionEventArgs(ex)
                {
                    ExceptionHandled = false
                });
            }
        }
Beispiel #3
0
        /// <summary>
        /// 干活
        /// </summary>
        private void Run()
        {
            try
            {
                while (true)
                {
                    if (!IsRuning)
                    {
                        return;
                    }
                    if (IsSleeping)
                    {
                        OnWaked(new EventArgs());
                    }

                    IList<MessageEntity> toExecutes = this.Ontology.MessageProvider.GetTopNCommands(MessageTypeKind.Received, this.Ontology, this.Ontology.Ontology.ExecutorLoadCount, "CreateOn", "asc"); ;
                    IList<MessageContext> descriptors = new List<MessageContext>();
                    if (toExecutes == null || toExecutes.Count == 0)
                    {
                        Sleep(new SleepingEventArgs(this.Ontology.Ontology.ExecutorSleepTimeSpan));
                        continue;
                    }
                    else
                    {
                        foreach (var item in toExecutes)
                        {
                            var context = new MessageContext(this.Process.AcDomain, item);
                            var eArgs = new ExecutedEventArgs(context);
                            OnExecuting(eArgs);
                            MessageHandler.Instance.Response(context);
                            if (context.Result.Status == (int)Status.ExecuteOk)
                            {
                                SucessCount++;
                            }
                            else
                            {
                                FailCount++;
                            }

                            eArgs.ExecutedOn = DateTime.Now;
                            OnExecuted(eArgs);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                OnError(new ExceptionEventArgs(ex) { ExceptionHandled = false });
            }
        }
Beispiel #4
0
 private void OnExecuted(ExecutedEventArgs e)
 {
     if (Executed != null)
     {
         Executed(this, e);
     }
 }