首页>代码>spring batch+quartz模拟定时将数据库表中的数据过滤备份(入门篇)>/springBatch2/src/main/java/com/cn/stephen/springbatch2/listener/AppJobExecutionListener.java
package com.cn.stephen.springbatch2.listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobExecutionListener;
import org.springframework.stereotype.Component;

@Component("appJobExecutionListener")
public class AppJobExecutionListener implements JobExecutionListener {
	private final static Logger logger = LoggerFactory.getLogger(AppJobExecutionListener.class);

	public void afterJob(JobExecution jobExecution) {
		if (jobExecution.getStatus() == BatchStatus.COMPLETED) {
			logger.info("Job completed: " + jobExecution.getJobId());
		} else if (jobExecution.getStatus() == BatchStatus.FAILED) {
			logger.info("Job failed: " + jobExecution.getJobId());
		}
	}

	public void beforeJob(JobExecution jobExecution) {
		if (jobExecution.getStatus() == BatchStatus.COMPLETED) {
			logger.info("Job completed: " + jobExecution.getJobId());
		} else if (jobExecution.getStatus() == BatchStatus.FAILED) {
			logger.info("Job failed: " + jobExecution.getJobId());
		}
	}
}
最近下载更多
changup  LV6 2022年2月2日
雾岛听风  LV7 2021年10月20日
v512345  LV10 2020年6月19日
zhwang  LV19 2020年6月17日
zhangdd  LV10 2020年6月4日
lovejing  LV7 2020年5月16日
dcowl123  LV1 2020年3月17日
liudeshuai970926  LV6 2020年3月2日
laowantong260  LV7 2020年1月10日
苏小六  LV1 2019年6月1日
最近浏览更多
Gin19960217  LV4 3月18日
lironggang  LV38 2023年3月28日
F丶S丶H  LV7 2023年1月29日
xuexizhuanyong23  LV16 2022年10月18日
pxqtsht  LV15 2022年3月21日
fangen0005  LV25 2022年3月9日
changup  LV6 2022年2月2日
huaua7676  LV30 2022年1月23日
雾岛听风  LV7 2021年10月20日
cc900118  LV17 2021年8月28日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友