내 작업 중 하나의 방아쇠를 변경하고 싶습니다. 그래서 내가하고있는 일은 내 일에 그 일과 관련이있는 트리거가 있는지 먼저 확인하는 것입니다. 그렇다면 사용자가 선택한 새 트리거가있는 Reschedule
입니다. 그러나 내가 AdoJobStore
을 볼 때 새로운 트리거는 거기에 없으며 작업은 다시 일정을 잡은 후에 실행을 멈 춥니 다.작업 일정 조정이 작동하지 않습니다.
은 내가 try-catch
블록이 전체 코드를 넣어 가지고,하지만 난 어떤 Exception
의가 수신되지 않는,하지만 난 JobExecutionException
의 대신 단지 Exception
의를 잡을해야하기 때문에 그것은 어쩌면인가?
var jobKey = new JobKey(jobName, jobGroup);
IScheduler sched = scheduler.GetScheduler();
IList<ITrigger> triggers = sched.GetTriggersOfJob(jobKey);
if (triggers.Count != 0)
{
ITrigger existingTrigger = triggers[0];
sched.UnscheduleJob(existingTrigger.Key);
ITrigger newTrigger = BuildTrigger(triggerName, triggerGroup);
IJobDetail job = sched.GetJobDetail(jobKey);
DialogResult dr = MsgBox.Show(string.Format("Confirm campaign '{0}' with the schedule '{1}'?", lblCampaignName.Text, txtbxMessage.Text), "Confirm Schedule", MsgBox.Buttons.YesNo, MsgBox.Icon.Question);
if (dr == DialogResult.Yes)
{
sched.RescheduleJob(existingTrigger.Key, newTrigger);
int updateResult = UpdateCampaignSchedule();
if (updateResult == 1)
MsgBox.Show("Campaign schedule successfully updated!", "Edit schedule", MsgBox.Buttons.OK, MsgBox.Icon.Info);
else
MsgBox.Show("Unable to update campaign schedule in the database.", "Edit schedule", MsgBox.Buttons.OK, MsgBox.Icon.Error);
}
}
else
{
..
}