/// <summary> /// 停止无效job的运行(通过删除job实现) /// </summary> private void StopInvalidJob(List <Job_Config> list) { var invalidList = list.Where(x => x.Status == (int)JobStatusEnum.Updated || x.Status == (int)JobStatusEnum.Delete).ToList(); if (invalidList.Count == 0) { return; } var wrapper = new CallWrapper(); foreach (var item in invalidList) { var jobInfo = new JobInfo { GroupName = item.GroupName, JobName = item.JobName }; wrapper.JobInfo = jobInfo; wrapper.CallDeleteJob(); if (item.Status == (int)JobStatusEnum.Updated && !item.IsEnable) { UpdateJobConfig(item.ID); } if (item.Status == (int)JobStatusEnum.Delete) { DeleteJobConfig(item.ID); } } }
/// <summary> /// 同步配置 /// </summary> /// <param name="list"></param> private void SyncJob(List <Job_Config> list) { var wrapper = new CallWrapper(); foreach (var item in list) { try { wrapper.JobInfo = GetJobInfo(item); jobDomain.DoCallBack(new CrossAppDomainDelegate(wrapper.CallAddJob)); UpdateJobConfig(item.ID); } catch (Exception ex) { var outerEx = new Exception(string.Format("同步Job失败。JobName:{0}", item.JobName), ex); logger.Error(outerEx); } } }