use of com.vip.saturn.job.internal.control.ExecutionInfo in project Saturn by vipshop.
the class ExecutionService method registerJobCompletedReportInfoByItem.
/**
* 作业完成信息注册,此信息用于页面展现。注意,无论作业是否上报状态(对应/config/enabledReport/节点),都会注册此信息。
*/
public void registerJobCompletedReportInfoByItem(final JobExecutionMultipleShardingContext jobExecutionShardingContext, int item, Date nextFireTimePausePeriodEffected) {
ExecutionInfo info = reportService.getInfoByItem(item);
if (info == null) {
// old data has been flushed to zk.
info = new ExecutionInfo(item);
}
if (jobExecutionShardingContext instanceof SaturnExecutionContext) {
// 为了展现分片处理失败的状态
SaturnExecutionContext saturnContext = (SaturnExecutionContext) jobExecutionShardingContext;
if (saturnContext.isSaturnJob()) {
SaturnJobReturn jobRet = saturnContext.getShardingItemResults().get(item);
if (jobRet != null) {
int errorGroup = jobRet.getErrorGroup();
info.setJobMsg(jobRet.getReturnMsg());
// 如果作业执行成功且不展示日志,则不展现log
if (errorGroup == SaturnSystemErrorGroup.SUCCESS && !configService.showNormalLog()) {
info.setJobLog(null);
} else {
info.setJobLog(saturnContext.getJobLog(item));
}
} else {
info.setJobMsg(NO_RETURN_VALUE);
}
}
}
if (nextFireTimePausePeriodEffected != null) {
info.setNextFireTime(nextFireTimePausePeriodEffected.getTime());
}
info.setLastCompleteTime(System.currentTimeMillis());
reportService.fillInfoOnAfter(info);
}
Aggregations