Exemple #1
0
 public bool UpdateJob(Job job)
 {
     _logger.DebugFormat("UpdateJob, {0}", job);
     lock (_jobRunnerList)
     {
         bool      result = true;
         JobRunner jbr    = GetJobRunner(job);
         if (jbr != null)
         {
             if (job.IsActived)
             {
                 jbr.Uninit();
                 result = jbr.Init(this);
             }
             else
             {
                 result = true;
             }
         }
         else
         {
             result = false;
         }
         _rescheduleEvent.Set();
         return(result);
     }
 }
Exemple #2
0
        public bool AddJob(Job job)
        {
            _logger.DebugFormat("AddJob, {0}", job);
            lock (_jobRunnerList)
            {
                bool      result = false;
                JobRunner jbr    = JobRunnerBuilder.Build(job);
                if (jbr != null)
                {
                    bool retInit = true;
                    if (job.IsActived)
                    {
                        retInit = jbr.Init(this);
                    }

                    if (retInit)
                    {
                        _jobList.Add(job);
                        _jobRunnerList.Add(jbr);
                        _rescheduleEvent.Set();
                        result = true;
                    }
                    else
                    {
                        _logger.Debug("Job Init Failed");
                        result = false;
                    }
                }
                else
                {
                    _logger.DebugFormat("AddJob Failed, Job Runnder == null, {0}", job);
                }

                return(result);
            }
        }