コード例 #1
0
ファイル: Jobs.cs プロジェクト: nguyenhuy2911/CMS
 /// <summary>
 /// Attaches the job.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="job">The job.</param>
 /// <param name="interval">The interval.</param>
 /// <param name="executionState">State of the execution.</param>
 /// <returns></returns>
 public JobExecutor AttachJob(string name, IJob job, int interval, object executionState)
 {
     if (!jobs.ContainsKey(name))
     {
         lock (lockHelper)
         {
             if (!jobs.ContainsKey(name))
             {
                 var jobExecutor = new JobExecutor(job, interval, executionState);
                 jobs[name] = jobExecutor;
                 jobExecutor.Start();
                 return(jobExecutor);
             }
         }
     }
     return(null);
 }
コード例 #2
0
ファイル: Jobs.cs プロジェクト: Epitomy/CMS
 public JobExecutor AttachJob(string name, IJob job, int interval, object executionState)
 {
     if (!jobs.ContainsKey(name))
     {
         lock (lockHelper)
         {
             if (!jobs.ContainsKey(name))
             {
                 var jobExecutor = new JobExecutor(job, interval, executionState);
                 jobs[name] = jobExecutor;
                 jobExecutor.Start();
                 return jobExecutor;
             }
         }
     }
     return null;
 }