NutzCN Logo
问答 参考 nutzbook 使用 quartz 未有执行任务 大神来See See
发布于 3110天前 作者 SniperZj 2012 次浏览 复制 上一个帖子 下一个帖子
标签:
五月 17, 2016 3:14:01 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 10985 ms
2016-05-17 15:14:29,681 [NutzbookScheduler_QuartzSchedulerThread] DEBUG org.quartz.core.QuartzSchedulerThread - batch acquisition of 0 triggers
2016-05-17 15:14:53,964 [NutzbookScheduler_QuartzSchedulerThread] DEBUG org.quartz.core.QuartzSchedulerThread - batch acquisition of 0 triggers
2016-05-17 15:15:22,685 [NutzbookScheduler_QuartzSchedulerThread] DEBUG org.quartz.core.QuartzSchedulerThread - batch acquisition of 0 triggers
2016-05-17 15:15:46,943 [NutzbookScheduler_QuartzSchedulerThread] DEBUG org.quartz.core.QuartzSchedulerThread - batch acquisition of 0 triggers
2016-05-17 15:16:14,364 [NutzbookScheduler_QuartzSchedulerThread] DEBUG org.quartz.core.QuartzSchedulerThread - batch acquisition of 0 triggers
2016-05-17 15:16:38,546 [NutzbookScheduler_QuartzSchedulerThread] DEBUG org.quartz.core.QuartzSchedulerThread - batch acquisition of 0 triggers

@IocBean
public class CleanNonActiveUserJob implements Job {

    private static final Log log = Logs.get();

    @Inject protected Dao dao;

  
    public void execute(JobExecutionContext context) throws JobExecutionException {
    	System.out.println(">>>>>>>>>>>>>>>");
       
    }
}

@SetupBy(value=MainSetup.class)
@IocBy(type = ComboIocProvider.class, args = { "*js", "ioc/", "*anno",
	"com.zhangjie.project","*org.nutz.integration.autoloadcache.AutoLoadCacheIocLoader","*org.nutz.integration.quartz.QuartzIocLoader"})
@Encoding(input = "UTF-8", output = "UTF-8")
@Ok("json:full")
@Fail("jsp:jsp.500")
@Localization(value="msg/", defaultLocalizationKey="zh-CN")
@ChainBy(args="mvc/mvc-chain.js")
@Modules(scanPackage = true)
public class MainModule {

}



MainSetup:
	// 特别留意一下,是init方法,不是destroy方法!!!!!
	public void init(NutConfig conf) {
		Ioc ioc = conf.getIoc();
		Dao dao = ioc.get(Dao.class);
		Daos.createTablesInPackage(dao, "com.zhangjie.project", false);
		// 获取NutQuartzCronJobFactory从而触发计划任务的初始化与启动
		ioc.get(NutQuartzCronJobFactory.class);
	}

cron.properties:
com.zhangjie.project.quartz.job.CleanNonActiveUserJob=0 0/1 * * * ?

quartz.properties:
org.quartz.scheduler.instanceName = NutzbookScheduler 
org.quartz.threadPool.threadCount = 3 
org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
org.quartz.scheduler.skipUpdateCheck=true

2 回复

这里写错了

com.zhangjie.project.quartz.job.CleanNonActiveUserJob=0 0/1 * * * ?

需要cron.开头的,改成

cron.com.zhangjie.project.quartz.job.CleanNonActiveUserJob=0 0/1 * * * ?
添加回复
请先登陆
回到顶部