jfinal-scheduler 的任务没有正常执行,求大神解决、、、、、、、

一夜微尘丶 发布于 2016/10/28 14:25
阅读 453
收藏 0

我是加载配置文件启动定时器的,

@Override
public void configPlugin(Plugins me) {
SchedulerPlugin sp = new SchedulerPlugin("job.properties");
Runnable task = new Task();
sp.fixedDelaySchedule(task, 10);
me.add(sp);


job.properties:

#是否启用该任务
testJob.enable=true
#任务类名
testJob.class=com.hongye.app.controller.Task
#每隔10秒(每分钟6次)执行一次
testJob.type=fixedRate
testJob.expr=10

task:

public class Task implements Runnable{
private static Logger log = Logger.getLogger(Task.class);
public void run() {
System.out.println(123);
System.err.println(456);
String sql = "selrct c_time as time from order_info order by time desc";
List<OrderInfoModel> order_list = OrderInfoModel.dao.find(sql);
if(log.isInfoEnabled()){log.info("order_list"+order_list);}
}
}
console:

456
123
456
123


2016-10-28 13:56:28
[INFO]-[Thread: localhost-startStop-1]-[com.jfinal.plugin.scheduler.SchedulerPlugin.loadJob()]: --------load job: testJob successfully--------


2016-10-28 13:56:29
[INFO]-[Thread: localhost-startStop-1]-[com.jfinal.plugin.scheduler.SchedulerPlugin.loadJob()]: class: com.hongye.app.controller.Task


2016-10-28 13:56:29
[INFO]-[Thread: localhost-startStop-1]-[com.jfinal.plugin.scheduler.SchedulerPlugin.loadJob()]: type : fixedRate


2016-10-28 13:56:29
[INFO]-[Thread: localhost-startStop-1]-[com.jfinal.plugin.scheduler.SchedulerPlugin.loadJob()]: expr : 10


2016-10-28 13:56:29
[INFO]-[Thread: localhost-startStop-1]-[com.jfinal.plugin.scheduler.SchedulerPlugin.loadJob()]: ----------------


2016-10-28 13:56:29
[INFO]-[Thread: localhost-startStop-1]-[com.jfinal.plugin.scheduler.SchedulerPlugin.start()]: SchedulerPlugin is started


2016-10-28 13:56:32
[INFO]-[Thread: localhost-startStop-1]-[com.alibaba.druid.pool.DruidDataSource.init()]: {dataSource-1} inited

加载中
0
玛雅牛
玛雅牛

问题描述不清,从日志看执行了。输出了日志了。不知道为啥没有执行。

一夜微尘丶
你好, 我这边调试好了,谢谢你的代码
0
Dogu
Dogu

我这边也是这种情况

#是否启用该任务
testJob.enable=true
#任务类名
testJob.class=com.dogu.timmer.testTimmer
#每隔10秒(每分钟6次)执行一次
testJob.type= fixedRate
testJob.expr= 1

返回顶部
顶部