Example #1
0
 protected void PerformTask(AcaciaTask task)
 {
     try
     {
         task.Execute();
     }
     finally
     {
         Interlocked.Increment(ref Statistics.FinishedTasks);
     }
 }
Example #2
0
 public static void Task(AcaciaTask task, bool synchronous = false)
 {
     if (synchronous)
     {
         task.Execute();
     }
     else
     {
         Executor.AddTask(task);
     }
 }
Example #3
0
        public static void Task(AcaciaTask task, bool synchronous = false)
        {
            task.TaskId = Interlocked.Increment(ref _taskId);

            Logger.Instance.Trace(typeof(Tasks), "TASK added: {0}", task);
            if (synchronous)
            {
                Logger.Instance.Trace(typeof(Tasks), "TASK exec synchronous 1: {0}", task);
                task.Execute();
                Logger.Instance.Trace(typeof(Tasks), "TASK exec synchronous 2: {0}", task);
            }
            else
            {
                Executor.AddTask(task);
            }
        }
Example #4
0
 protected void PerformTask(AcaciaTask task)
 {
     try
     {
         Tracer?.OnTaskExecuting(task);
         task.Execute();
     }
     catch (Exception e)
     {
         Tracer?.OnTaskFailed(task, e);
         throw e;
     }
     finally
     {
         Tracer?.OnTaskExecuted(task);
         Interlocked.Increment(ref Statistics.FinishedTasks);
     }
 }