日期:2014-05-20 浏览次数:21345 次
public class JobOne implements Job {
private static final Logger LOGGER = LoggerFactory
.getLogger(JobOne.class);
/**
* 任务是否正在执行标记 :false--未执行; true--正在执行; 默认未执行
*/
private static boolean isRun = false;
public void execute(JobExecutionContext jobContext)
throws JobExecutionException {
// 任务正在执行,跳过本次执行
if (isRun) {
JobDetail jobDetail = jobContext.getJobDetail();
LOGGER.info(jobDetail.getGroup() + "." + jobDetail.getName()
+ ":前一次未执行完,跳过本次任务!");
return;
}
isRun = true;
task();
isRun = false;
}
/**
* 任务执行的主题
*/
protected void task(){
};
}