当执行job出现异常的时候如何处理?
1.将这个exception包装为JobExecutionException
try {
int zero = 0;
int calculation = 4815 / zero;
} catch (Exception e) {
System.out.println("--- Error in job!");
JobExecutionException e2 =
new JobExecutionException(e);
// this job will refire immediately
e2.setRefireImmediately(true);
throw e2;
}
2.设置JobExecutionException的属性
如果 e2.setRefireImmediately(true);
则在检测到异常后重新执行job
如果 e2.setUnscheduleAllTriggers(true);
则检测到异常后会退出job
更多的属性用到的时候再google