private static void ExecuteTask(SysTask task)
        {
            try
            {
                ISysTaskExecutor executor = SysTaskSettings.GetSettings().GetExecutor(task.TaskType);

                executor.BeforeExecute(task);
                Task.Factory.StartNew(() => executor.Execute(task));
            }
            catch (System.Exception ex)
            {
                SysTaskAdapter.Instance.MoveToCompletedSysTask(task.TaskID, SysTaskStatus.Aborted, ex.GetRealException().ToString());
            }
        }
Beispiel #2
0
        private static void ExecuteTask(SysTask task)
        {
            try
            {
                //2014-4-19 by haoyk
                //当作业还没执行完成,将不再执行此任务
                if (task.Status != SysTaskStatus.Running)
                {
                    ISysTaskExecutor executor = SysTaskSettings.GetSettings().GetExecutor(task.TaskType);

                    executor.BeforeExecute(task);
                    Task.Factory.StartNew(() => executor.Execute(task));
                }
            }
            catch (System.Exception ex)
            {
                SysTaskAdapter.Instance.MoveToCompletedSysTask(task.TaskID, SysTaskStatus.Aborted, ex.GetRealException().ToString());
            }
        }