} // ctor protected override void OnRunJob(CancellationToken cancellation) { CheckCronEngine(); using (EnterReadLock()) { var tasks = new List <Task>(); Log.Info("Start tasks..."); this.WalkChildren <ICronJobExecute>( c => { Log.Info("{0}: Started...", c.DisplayName); tasks.Add(CronEngine.ExecuteJobAsync(c, cancellation)); }, true, true); Task.WaitAll(tasks.ToArray(), cancellation); Log.Info("{0}: All tasks finished."); } } // proc RunJob
} // ctor protected override void OnRunJob(CancellationToken cancellation) { CheckCronEngine(); this.WalkChildren <ICronJobExecute>( c => { if (cancellation.IsCancellationRequested) { return; } if (StateRunning != null) { StateRunning.Value = c.DisplayName; } Log.Info("{0}: started...", c.DisplayName); CronEngine.ExecuteJobAsync(c, cancellation); Log.Info("{0}: finished.", c.DisplayName); }, true); } // proc RunJob
/// <summary>Execute more than one job.</summary> /// <param name="job"></param> protected async Task ExecuteJobAsync(ICronJobExecute job, CancellationToken cancellation) { CheckCronEngine(); await CronEngine.ExecuteJobAsync(job, cancellation); } // proc ExecuteJobAsync