Пример #1
0
 /// <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
 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;
 }