quartz定时任务插件问题,项目启动时job状态normal,一旦执行变为error

SLLK 发布于 2016/10/08 16:37
阅读 609
收藏 0
创建任务代码片段,每次启动项目会正常生成job,状态为NORMAL
private void initXXXJob() throws SchedulerException {
		JobDetail jobDetail = JobBuilder
				.newJob(XXXJob.class)
				.withIdentity("XXXJob","XXXJob").build();

		CronTrigger trigger = TriggerBuilder
				.newTrigger()
				.withIdentity("XXXJob","XXXJob")
				.forJob(jobDetail).withSchedule(
						CronScheduleBuilder.cronSchedule("0 10 4 * * ? *"))
				.build();
		scheduler.scheduleJob(jobDetail, trigger);
	}

job类代码

@Component
public class XXXJob implements Job{
	
	@Logger
	static Log log;
	
	@Resource
	public XXXHome xxxHome;
	
	private static boolean isRunning = false;
	
	@Override
	public void execute(JobExecutionContext arg0) throws JobExecutionException {
		
		if(isRunning){ 
			return;
		}
		isRunning = true;
		try {
			xxxHome.download();
		} catch (Exception e) {
			e.printStackTrace();
			log.error(e.getMessage());
			isRunning = false;
		} finally{
			isRunning = false;
		}
		
	}
}

看不到任何报错啊,在execute方法里打断点,发现没有进入方法,每当执行之后,job的status就会变成ERROR,应该从什么地方考虑这个问题呢?





加载中
0
S
SLLK
没有进入execute方法,直接变为ERROE的
返回顶部
顶部