This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
k18-ntcs-web-ntc/src/main/java/com/nis/quartz/ScheduleStatusJob.java
zhangwei 9d6e3a3d4a 增加定时器功能
Conflicts:
	src/main/webapp/WEB-INF/views/cfg/ipaddr/ipList.jsp
2019-01-26 20:18:01 +06:00

39 lines
1.4 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.nis.quartz;
import org.apache.log4j.Logger;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import com.nis.domain.ScheduleCfg;
import com.nis.web.service.ScheduleService;
import com.nis.web.service.SpringContextHolder;
/**
* 定时任务 真正执行类
* 配置状态下发
* 从trigger 的 jobDataMap 中取出 相关数据compile,isValid
* @author fang
*
*/
public class ScheduleStatusJob implements Job{
private static final Logger log = Logger.getLogger(ScheduleStatusJob.class);
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
//从trigger中 获取 配置信息
JobDataMap jobDataMap = context.getTrigger().getJobDataMap();
boolean isValid = jobDataMap.getBoolean("isValid");
ScheduleCfg cfg = (ScheduleCfg)jobDataMap.get("cfg");
Integer compileId = cfg.getCompileId();
log.debug(String.format("任务开始执行compileId:%s,isValid:%s",compileId,isValid ));
//配置下发,并修改 配置表的状态,保存下发记录等
ScheduleService scheduleService = SpringContextHolder.getBean(ScheduleService.class);
scheduleService.issueCompileInfo(cfg, isValid?1:0);
log.debug(String.format("任务开始执行compileId:%s,isValid:%s",compileId,isValid ));
}
}