本文整理匯總了Java中org.springframework.batch.core.JobExecution.setExitStatus方法的典型用法代碼示例。如果您正苦於以下問題:Java JobExecution.setExitStatus方法的具體用法?Java JobExecution.setExitStatus怎麽用?Java JobExecution.setExitStatus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.batch.core.JobExecution
的用法示例。
在下文中一共展示了JobExecution.setExitStatus方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: mapRow
import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
/**
* @param resultSet Set the result set
* @param rowNumber Set the row number
* @throws SQLException if there is a problem
* @return a job execution instance
*/
public final JobExecution mapRow(final ResultSet resultSet,
final int rowNumber) throws SQLException {
JobInstance jobInstance = new JobInstance(resultSet.getBigDecimal(
"JOB_INSTANCE_ID").longValue(),
new JobParameters(), resultSet.getString("JOB_NAME"));
JobExecution jobExecution = new JobExecution(jobInstance,
resultSet.getBigDecimal("JOB_EXECUTION_ID").longValue());
jobExecution.setStartTime(resultSet.getTimestamp("START_TIME"));
jobExecution.setCreateTime(resultSet.getTimestamp("CREATE_TIME"));
jobExecution.setEndTime(resultSet.getTimestamp("END_TIME"));
jobExecution.setStatus(BatchStatus.valueOf(resultSet
.getString("STATUS")));
ExitStatus exitStatus = new ExitStatus(
resultSet.getString("EXIT_CODE"),
resultSet.getString("EXIT_MESSAGE"));
jobExecution.setExitStatus(exitStatus);
return jobExecution;
}
示例2: afterJob
import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
@Override
public void afterJob(JobExecution jobExecution) {
StringBuffer exitDescription = new StringBuffer();
if (jobExecution.getJobParameters().getString("job.configuration.id") != null) {
JobConfiguration jobConfiguration = jobConfigurationService.get(Long.parseLong(jobExecution.getJobParameters().getString("job.configuration.id")));
exitDescription.append(jobConfiguration.getDescription() + " " + jobExecution.getExitStatus().getExitCode());
exitDescription.append(". " + jobExecution.getStepExecutions().size() + " Steps Completed.");
jobExecution.setExitStatus(jobExecution.getExitStatus().addExitDescription(exitDescription.toString()));
jobConfiguration.setJobStatus(jobExecution.getStatus());
jobRepository.update(jobExecution);
logger.info(jobExecution.getExitStatus().getExitCode() + " " + jobExecution.getExitStatus().getExitDescription());
}
}
示例3: afterJob
import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
@Override
public void afterJob(JobExecution jobExecution) {
if(jobExecution.getStatus() == BatchStatus.COMPLETED) {
long statId = (long) jobExecution.getExecutionContext().get("statId");
logger.info("!!! GITHUB JOB FINISHED! CURRENT STATID: " + statId);
ExitStatus es = jobExecution.getExitStatus();
jobExecution.setExitStatus(new ExitStatus(es.getExitCode(), String.valueOf(statId)));
}
}
示例4: afterJob
import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
@Override
public void afterJob(JobExecution jobExecution) {
for (StepExecution stepExecution : jobExecution.getStepExecutions()) {
if (stepExecution.getSkipCount() > 0) {
jobExecution.setExitStatus(ExitStatus.FAILED);
jobExecution.setStatus(BatchStatus.FAILED);
return;
}
}
}
示例5: unmarshal
import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
@Override
public JobExecution unmarshal(AdaptedJobExecution v) throws Exception {
JobExecution jobExec = new JobExecution(v.getId(), v.getJobParameters());
jobExec.setJobInstance(v.getJobInstance());
jobExec.setCreateTime(v.getCreateDateTime());
jobExec.setEndTime(v.getEndDateTime());
jobExec.setLastUpdated(v.getLastUpdatedDateTime());
jobExec.setStartTime(v.getStartDateTime());
jobExec.setStatus(BatchStatus.valueOf(v.getStatus()));
jobExec.setExitStatus(new ExitStatus(v.getExitCode(), ""));
jobExec.addStepExecutions(v.getStepExecutions());
jobExec.setVersion(v.getVersion());
jobExec.setExecutionContext(v.getExecutionContext());
return jobExec;
}
示例6: afterJob
import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
@Override
public void afterJob(JobExecution jobExecution) {
Period duration = new Period(jobExecution.getEndTime().getTime() - jobExecution.getStartTime().getTime());
StringBuffer exitDescription = new StringBuffer();
if (jobExecution.getJobInstance().getJobParameters().getString("resource.identifier") != null) {
long info = 0;
long warn = 0;
long error = 0;
Resource resource = resourceService.find(jobExecution
.getJobInstance().getJobParameters()
.getString("resource.identifier"));
Map<String, String> selectedFacets = new HashMap<String, String>();
selectedFacets.put("base.class_s", "org.emonocot.model.Annotation");
selectedFacets.put("annotation.job_id_l", new Long(jobExecution.getId()).toString());
try {
Page<Annotation> result = annotationService.search(null, null,
1, 0, new String[] { "annotation.type_s" }, null,
selectedFacets, null, "annotated-obj");
FacetField annotationTypes = result.getFacetField("annotation.type_s");
for (FacetField.Count value : annotationTypes.getValues()) {
if(value.getName() == null) {
} else {
switch (value.getName()) {
case "Info":
info = value.getCount();
break;
case "Warn":
warn = value.getCount();
break;
case "Error":
error = value.getCount();
break;
default:
break;
}
}
}
} catch (SolrServerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
exitDescription.append("Harvested " + resource.getTitle() + " " + jobExecution.getExitStatus().getExitCode());
exitDescription.append(". " + jobExecution.getStepExecutions().size() + " Steps Completed.");
exitDescription.append(" Duration: " + periodFormatter.print(duration) + ".");
exitDescription.append(" Issues - Info: " + info + ", warnings: "
+ warn + ", Errors: " + error);
jobExecution.setExitStatus(jobExecution.getExitStatus().addExitDescription(exitDescription.toString()));
jobRepository.update(jobExecution);
logger.info(jobExecution.getExitStatus().getExitCode() + " " + jobExecution.getExitStatus().getExitDescription());
User user = userService.find(systemUser);
// Create comment if a systemUser exists
if(user != null) {
Comment comment = new Comment();
comment.setIdentifier(UUID.randomUUID().toString());
comment.setComment(exitDescription.toString());
comment.setCreated(new DateTime());
comment.setStatus(Comment.Status.PENDING);
comment.setUser(user);
comment.setAboutData(resource);
comment.setCommentPage(resource);
commentService.save(comment);
}
} else {
exitDescription.append(jobExecution.getJobInstance().getJobName() + " " + jobExecution.getExitStatus().getExitCode());
exitDescription.append(". " + jobExecution.getStepExecutions().size() + " Steps Completed.");
exitDescription.append(" Duration: " + periodFormatter.print(duration) + ".");
jobExecution.setExitStatus(new ExitStatus(jobExecution.getExitStatus().getExitCode(),exitDescription.toString()));
jobRepository.update(jobExecution);
logger.info(jobExecution.getExitStatus().getExitCode() + " " + jobExecution.getExitStatus().getExitDescription());
}
}