コード例 #1
0
 private void FailedExecution(IEnumerable <TaskExecutionResult> taskFailureInfos)
 {
     _session.Transact(session => taskFailureInfos.ForEach(
                           taskFailureInfo =>
     {
         AdHocTask executableTask = taskFailureInfo.Task;
         executableTask.Entity.OnFailure(executableTask, taskFailureInfo.Exception);
         session.Update(executableTask.Entity);
     }));
 }
コード例 #2
0
 private TaskExecutionResult Execute(AdHocTask executableTask)
 {
     try
     {
         return(executableTask.Execute());
     }
     catch (Exception exception)
     {
         CurrentRequestData.ErrorSignal.Raise(exception);
         return(TaskExecutionResult.Failure(executableTask, exception));
     }
 }
コード例 #3
0
 public virtual void OnFailure(AdHocTask executableTask, Exception exception)
 {
     executableTask.OnFailure(exception);
     if (Tries < 5)
     {
         Status = TaskExecutionStatus.Pending;
     }
     else
     {
         Status   = TaskExecutionStatus.Failed;
         FailedAt = CurrentRequestData.Now;
         executableTask.OnFinalFailure(exception);
     }
     Tries++;
 }
コード例 #4
0
ファイル: TaskExecutor.cs プロジェクト: rahulyhg/MaterialCMS
     public BatchExecutionResult Execute(AdHocTask task)
     {
         if (task != null)
         {
             IList <AdHocTask> tasksToExecute = new List <AdHocTask> {
                 task
             };
             foreach (var handler in _executionHandlers.OrderByDescending(handler => handler.Priority))
             {
                 var tasks = handler.ExtractTasksToHandle(ref tasksToExecute);
                 if (tasks.Any())
                 {
                     return new BatchExecutionResult {
                                Results = handler.ExecuteTasks(tasks)
                     }
                 }
                 ;
             }
         }
         return(new BatchExecutionResult());
     }
 }
コード例 #5
0
 public static TaskExecutionResult Failure(AdHocTask task, Exception exception)
 {
     return(new TaskExecutionResult {
         Success = false, Task = task, Exception = exception
     });
 }
コード例 #6
0
 public static TaskExecutionResult Successful(AdHocTask task)
 {
     return(new TaskExecutionResult {
         Success = true, Task = task
     });
 }
コード例 #7
0
 public virtual void OnSuccess(AdHocTask executableTask)
 {
     Status      = TaskExecutionStatus.Completed;
     CompletedAt = CurrentRequestData.Now;
     executableTask.OnSuccess();
 }
コード例 #8
0
 public virtual void OnStarting(AdHocTask executableTask)
 {
     Status    = TaskExecutionStatus.Executing;
     StartedAt = CurrentRequestData.Now;
     executableTask.OnStarting();
 }