private void Exec(bool inSync) { try { PerformStart = DateTime.Now; try { ActionPipe pipe = GetActionPipe(); if (pipe != null) { if (inSync) { pipe.Execute(); } else { pipe.StartExecution(); } } } finally { PerformEnd = DateTime.Now; PerformDuration = PerformEnd - PerformStart; } } catch (Exception e) { MakeErrorReport(e); } }
protected Task() { Reports = new List <TaskReport>(); BeforeActionPipe = new ActionPipe(); AfterActionPipe = new ActionPipe(); WorkItemPriority = WorkItemPriority.Normal; }
public ActionPipe GetActionPipe() { var mainPipe = new ActionPipe { ThreadPool = ThreadPool, WorkItemPriority = WorkItemPriority, OnException = OnException }; PrepareActionPipe(mainPipe); var taskPipe = new ActionPipe { ThreadPool = mainPipe.ThreadPool, WorkItemPriority = mainPipe.WorkItemPriority, OnException = mainPipe.OnException }; taskPipe.Pipe(() => PerformStart = DateTime.Now); taskPipe.Pipe(BeforeActionPipe); taskPipe.Pipe(mainPipe); taskPipe.Pipe(() => { PerformEnd = DateTime.Now; PerformDuration = PerformEnd - PerformStart; }); taskPipe.Pipe(MakeReport); taskPipe.Pipe(AfterActionPipe); return(taskPipe); }
protected override void PrepareActionPipe(ActionPipe actionPipe) { actionPipe.Pipe(Preconditions.CheckNotNull(OnExecute)); }
protected abstract void PrepareActionPipe(ActionPipe actionPipe);
public ActionPipe Pipe(ActionPipe actionPipe) { mActionGroups.AddRange(actionPipe.Select(ag => ag.ToList())); return(Pipe()); }