public void Execute(Quartz.IJobExecutionContext context) { IMyJob myjob = JobFactory.Instance.Find(context.JobDetail.Key); myjob.Load(); if (myjob.State != JobState.Working) { return; } JobFactory.Instance.JobRemove(myjob); myjob.Excute(); JobFactory.Instance.JobAdd(myjob); }
/// <summary> /// 立即执行job /// </summary> /// <param name="job"></param> void DoJob(IMyJob myjob) { try { JobRemove(myjob); if (myjob.State != JobState.Working) { return; } //获取订阅委托列表 myjob.Excute(); JobAdd(myjob); } catch (Exception ex) { } }