示例#1
0
 private void HttpStartAction()
 {
     CheckCronEngine();
     if (!CronEngine.StartJob(this))
     {
         throw new ArgumentException("Can not start job (it is running).");
     }
 }         // func HttpStartAction
示例#2
0
文件: CronEngine.cs 项目: s72785/des
        }         // 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
示例#3
0
文件: CronEngine.cs 项目: s72785/des
        }         // 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
示例#4
0
        /// <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