示例#1
0
        public void Add(IJob job, ITrigger trigger, int maxTaskNumber = 1)
        {
            JobProcess process = new JobProcess(job, maxTaskNumber);

            this.triggerAndProcessDict.TryAdd(trigger, process);
            this.triggerDict.TryAdd(job, trigger);
            this.processDict.TryAdd(job, process);
        }
示例#2
0
 internal JobTask(JobProcess process)
 {
     this.process = process;
     foreach (IJob job in this.process.Jobs)
     {
         this.succeedDict.Add(job, true);
     }
 }
示例#3
0
        public void Add(IEnumerable <IJob> jobs, ITrigger trigger, int maxTaskNumber = 1)
        {
            JobProcess process = new JobProcess(jobs, maxTaskNumber);

            this.triggerAndProcessDict.TryAdd(trigger, process);
            foreach (IJob job in jobs)
            {
                this.triggerDict.TryAdd(job, trigger);
                this.processDict.TryAdd(job, process);
            }
        }
示例#4
0
 private void schedule(DateTime time, ITrigger trigger, JobProcess process)
 {
     if (trigger.Trigger(time, process.SucceedCount, process.RunningCount))
     {
         bool ret = true;
         foreach (IJob job in process.Jobs)
         {
             ret = ret && this.canRunning(job);
         }
         if (ret)
         {
             process.StartATask();
         }
     }
 }