本文整理汇总了Java中org.springframework.batch.core.BatchStatus.FAILED属性的典型用法代码示例。如果您正苦于以下问题:Java BatchStatus.FAILED属性的具体用法?Java BatchStatus.FAILED怎么用?Java BatchStatus.FAILED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.springframework.batch.core.BatchStatus
的用法示例。
在下文中一共展示了BatchStatus.FAILED属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: afterJob
@Override
public void afterJob(JobExecution jobExecution) {
super.afterJob(jobExecution);
String jobName = jobExecution.getJobInstance().getJobName();
if (jobExecution.getStatus() == BatchStatus.FAILED) {
if (!CollectionUtils.isEmpty(jobExecution.getAllFailureExceptions())) {
for (Throwable t : jobExecution.getAllFailureExceptions()) {
LOG.info("job [{}] had exception: [{}]", jobName, t, t);
LOG.warn("job [{}] had exception: [{}]", jobName, t, "");
}
}
if (failedJobExecutionHandlers != null) {
for (FailedJobExecutionHandler handler : failedJobExecutionHandlers) {
if (handler.isApplicable(jobName)) {
try {
handler.handleFailedJobExecution(jobName);
} catch (Exception e) {
LOG.warn("exception on handling of failed job [{}] with handler [{}], [{}]", jobName, handler.getClass(), e, "");
}
}
}
}
}
LOG.info("job [{}] finished, start [{}], end [{}]", jobName, jobExecution.getStartTime(), jobExecution.getEndTime());
}
示例2: afterJob
@Override
public void afterJob(JobExecution jobExecution) {
if (jobExecution.getStatus() == BatchStatus.COMPLETED) {
StatusJobs.getMonitor(JOB_NAME, JOB_GROUP, jobExecution.getExecutionContext())
.done();
}
if (jobExecution.getStatus() == BatchStatus.FAILED) {
StatusJobs.getMonitor(JOB_NAME, JOB_GROUP, jobExecution.getExecutionContext())
.fail("Execution failure");
}
}
示例3: afterJob
@Override
public void afterJob(JobExecution je) {
JobParameters jobParams = je.getJobParameters();
Integer defId = Integer.valueOf(jobParams.getString("cohort_definition_id"));
Integer sourceId = Integer.valueOf(jobParams.getString("source_id"));
String targetDialect = jobParams.getString("target_dialect");
String cohortTable = jobParams.getString("target_database_schema") + "." + jobParams.getString("target_table");
DefaultTransactionDefinition completeTx = new DefaultTransactionDefinition();
completeTx.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
TransactionStatus completeStatus = this.transactionTemplate.getTransactionManager().getTransaction(completeTx);
CohortDefinition df = this.cohortDefinitionRepository.findOne(defId);
CohortGenerationInfo info = findBySourceId(df.getGenerationInfoList(), sourceId);
info.setExecutionDuration((int)(je.getEndTime().getTime() - je.getStartTime().getTime()));
info.setStatus(GenerationStatus.COMPLETE);
if (je.getStatus() == BatchStatus.FAILED) {
info.setIsValid(false);
info.setRecordCount(null);
info.setPersonCount(null);
info.setFailMessage(StringUtils.left(je.getAllFailureExceptions().get(0).getMessage(),2000));
} else {
info.setIsValid(true);
info.setFailMessage(null);
// query summary results from source
String statsQuery = "SELECT count(distinct subject_id) as person_count, count(*) as record_count from @cohort_table where cohort_definition_id = @cohort_definition_id";
String statsSql = SqlTranslate.translateSql(statsQuery, targetDialect, null, null);
String renderedSql = SqlRender.renderSql(statsSql, new String[]{"cohort_table", "cohort_definition_id"}, new String[]{cohortTable, defId.toString()});
Map<String, Object> stats = this.sourceTemplate.queryForMap(renderedSql);
info.setPersonCount(Long.parseLong(stats.get("person_count").toString()));
info.setRecordCount(Long.parseLong(stats.get("record_count").toString()));
}
this.cohortDefinitionRepository.save(df);
this.transactionTemplate.getTransactionManager().commit(completeStatus);
}
示例4: afterJob
@Override
public void afterJob(JobExecution jobExecution) {
log.info("작업 결과 상세. 시작=[{}], 완료=[{}], ExitStatus=[{}]",
jobExecution.getStartTime(), jobExecution.getEndTime(), jobExecution.getExitStatus());
if (jobExecution.getStatus() == BatchStatus.COMPLETED) {
log.info("작업이 성공적으로 완료되었습니다.");
} else if (jobExecution.getStatus() == BatchStatus.FAILED) {
log.info("작업이 실패했습니다.");
}
}
示例5: isStoppedOrFailed
private boolean isStoppedOrFailed(JobExecution execution) {
BatchStatus status = execution.getStatus();
return (status == BatchStatus.STOPPED || status == BatchStatus.FAILED);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:4,代码来源:JobLauncherCommandLineRunner.java