job类代码
package com.amax.quartz.job;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Files;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import java.io.IOException;
import java.util.Date;
/**
* Created by shawn_xiao on 2016/12/2.
*/
@IocBean
public class TestJob implements Job {
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
try {
Files.createFileIfNoExists("D:/"+new Date().toString()+".txt");
} catch (IOException e) {
e.printStackTrace();
}
}
}
custom/cron.properties里面
cron.com.amax.quartz.job.TestJob=0 0/2 * * * ?
mainsetup
public void init(NutConfig conf) {
Ioc ioc = conf.getIoc();
// 获取NutQuartzCronJobFactory从而触发计划任务的初始化与启动
ioc.get(NutQuartzCronJobFactory.class);
// Http.get("localhost:8688/amax_test/init");
}
添加quart后
日志显示它也在扫描但是没有任何反应,也不执行execute,也不报错求解
2016-12-02 17:39:13,772 [org.quartz.core.QuartzSchedulerThread]-[DEBUG] batch acquisition of 0 triggers
2016-12-02 17:39:41,897 [org.quartz.core.QuartzSchedulerThread]-[DEBUG] batch acquisition of 0 triggers
2016-12-02 17:40:08,426 [org.quartz.core.QuartzSchedulerThread]-[DEBUG] batch acquisition of 0 triggers
2016-12-02 17:40:31,439 [org.quartz.core.QuartzSchedulerThread]-[DEBUG] batch acquisition of 0 triggers
2016-12-02 17:40:55,844 [org.quartz.core.QuartzSchedulerThread]-[DEBUG] batch acquisition of 0 triggers
2016-12-02 17:41:22,978 [org.quartz.core.QuartzSchedulerThread]-[DEBUG] batch acquisition of 0 triggers
2016-12-02 17:41:50,459 [org.quartz.core.QuartzSchedulerThread]-[DEBUG] batch acquisition of 0 triggers