當前位置: 首頁>>代碼示例>>Java>>正文


Java JobExecution.getExitStatus方法代碼示例

本文整理匯總了Java中org.springframework.batch.core.JobExecution.getExitStatus方法的典型用法代碼示例。如果您正苦於以下問題:Java JobExecution.getExitStatus方法的具體用法?Java JobExecution.getExitStatus怎麽用?Java JobExecution.getExitStatus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.batch.core.JobExecution的用法示例。


在下文中一共展示了JobExecution.getExitStatus方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: save

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
/**
 *
 * @param jobExecution The jobExecution to save
 */
public final void save(final JobExecution jobExecution) {
	String exitCode = null;
	String exitDescription = null;
	if (jobExecution.getExitStatus() != null) {
		exitCode = jobExecution.getExitStatus().getExitCode();
		exitDescription = jobExecution.getExitStatus().getExitDescription();
	}
	getJdbcTemplate()
	.update("INSERT INTO BATCH_JOB_EXECUTION (JOB_EXECUTION_ID, VERSION, JOB_INSTANCE_ID, CREATE_TIME, START_TIME, END_TIME, STATUS, EXIT_CODE, EXIT_MESSAGE, LAST_UPDATED) VALUES (?,?,?,?,?,?,?,?,?,?)",
			jobExecution.getId(),
			jobExecution.getVersion(),
			jobExecution.getJobInstance().getId(),
			jobExecution.getCreateTime(),
			jobExecution.getStartTime(),
			jobExecution.getEndTime(),
			jobExecution.getStatus().name(),
			exitCode,
			exitDescription,
			jobExecution.getLastUpdated()
			);
}
 
開發者ID:RBGKew,項目名稱:eMonocot,代碼行數:26,代碼來源:JobExecutionDaoImpl.java

示例2: JobExecutionEvent

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
/**
 * Constructor for the StepExecution to initialize the DTO.
 *
 * @param original the StepExecution to build this DTO around.
 */
public JobExecutionEvent(JobExecution original) {
	this.jobParameters = new JobParametersEvent(original.getJobParameters().getParameters());
	this.jobInstance = new JobInstanceEvent(original.getJobInstance().getId(), original.getJobInstance().getJobName());
	for(StepExecution stepExecution : original.getStepExecutions()){
		stepExecutions.add(new StepExecutionEvent(stepExecution));
	}
	this.status = original.getStatus();
	this.startTime = original.getStartTime();
	this.createTime = original.getCreateTime();
	this.endTime = original.getEndTime();
	this.lastUpdated = original.getLastUpdated();
	this.exitStatus = new ExitStatus(original.getExitStatus());
	this.executionContext = original.getExecutionContext();
	this.failureExceptions = original.getFailureExceptions();
	this.jobConfigurationName = original.getJobConfigurationName();
	this.setId(original.getId());
	this.setVersion(original.getVersion());
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-task,代碼行數:24,代碼來源:JobExecutionEvent.java

示例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)));
    }
}
 
開發者ID:mintster,項目名稱:nixmash-blog,代碼行數:11,代碼來源:GithubJobListener.java

示例4: getProgress

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
@RequestMapping(value = "/progress", method = RequestMethod.GET, produces="application/json")
@ResponseBody
public JobExecutionInfo getProgress(@RequestParam("downloadId") Long downloadId, Locale locale) throws Exception {
	JobExecutionInfo jobExecutionInfo = new JobExecutionInfo();
	Resource resource = resourceService.load(downloadId);

	JobExecution jobExecution = jobExplorer.getJobExecution(resource.getJobId());
	if(jobExecution != null) {
		Float recordsRead = 0f;
		jobExecutionInfo.setStatus(jobExecution.getStatus());
		if(jobExecution.getExitStatus() != null) {
			ExitStatus exitStatus = jobExecution.getExitStatus();
			jobExecutionInfo.setExitCode(exitStatus.getExitCode());
			jobExecutionInfo.setExitDescription(exitStatus.getExitDescription());


			Integer readSkip = 0;
			Integer processSkip = 0;
			Integer writeSkip = 0;
			Integer written = 0;
			for(StepExecution stepExecution : jobExecution.getStepExecutions()) {
				recordsRead += stepExecution.getReadCount();
				readSkip += stepExecution.getReadSkipCount();
				processSkip += stepExecution.getProcessSkipCount();
				writeSkip += stepExecution.getWriteSkipCount();
				written += stepExecution.getWriteCount();
			}
			jobExecutionInfo.setRecordsRead(recordsRead.intValue());
			jobExecutionInfo.setReadSkip(readSkip);
			jobExecutionInfo.setProcessSkip(processSkip);
			jobExecutionInfo.setWriteSkip(writeSkip);
			jobExecutionInfo.setWritten(written);
		}
		Float total = Float.parseFloat(jobExecution.getJobInstance().getJobParameters().getString("job.total.reads"));

		jobExecutionInfo.setProgress(Math.round((recordsRead/ total) * 100f));
		if(resource.getBaseUrl() == null) {
			jobExecutionInfo.setExitDescription(messageSource.getMessage("download.being.prepared", new Object[] {}, locale));
		} else {
			String downloadFileName = resource.getParameters().get("download.file");
			if(jobExecutionInfo.getExitCode() == null) {
				jobExecutionInfo.setExitDescription(messageSource.getMessage("download.will.be.available", new Object[] {resource.getBaseUrl(), downloadFileName}, locale));
			} else {
				if(jobExecutionInfo.getExitCode().equals("COMPLETED")) {
					jobExecutionInfo.setExitDescription(messageSource.getMessage("download.is.available", new Object[] {messageSource.getMessage("portal.baseUrl", new Object[] {}, locale), downloadFileName}, locale));
				} else if(jobExecutionInfo.getExitCode().equals("FAILED")) {
					jobExecutionInfo.setExitDescription(messageSource.getMessage("download.failed", new Object[] {}, locale));
				} else {
					jobExecutionInfo.setExitDescription(messageSource.getMessage("download.will.be.available", new Object[] {messageSource.getMessage("portal.baseUrl", new Object[] {}, locale), downloadFileName}, locale));
				}
			}
		}

	}
	return jobExecutionInfo;
}
 
開發者ID:RBGKew,項目名稱:eMonocot,代碼行數:57,代碼來源:DownloadController.java

示例5: getProgress

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
@RequestMapping(value = "/{resourceId}/progress", method = RequestMethod.GET, produces="application/json")
@ResponseBody
public JobExecutionInfo getProgress(@PathVariable("resourceId") Long resourceId) throws Exception {
 JobExecutionInfo jobExecutionInfo = new JobExecutionInfo();
 Resource resource = getService().load(resourceId,"job-with-source");

 JobExecution jobExecution = jobExplorer.getJobExecution(resource.getJobId());
 if(jobExecution != null) {
	 jobExecutionInfo.setStatus(jobExecution.getStatus());
	 if(jobExecution.getExitStatus() != null) {
		 ExitStatus exitStatus = jobExecution.getExitStatus();
		 jobExecutionInfo.setExitCode(exitStatus.getExitCode());
		 jobExecutionInfo.setExitDescription(exitStatus.getExitDescription());

		 Integer recordsRead = 0;
		 Integer readSkip = 0;
		 Integer processSkip = 0;
		 Integer writeSkip = 0;
		 Integer written = 0;
		 for(StepExecution stepExecution : jobExecution.getStepExecutions()) {
			 recordsRead += stepExecution.getReadCount();
			 readSkip += stepExecution.getReadSkipCount();
			 processSkip += stepExecution.getProcessSkipCount();
			 writeSkip += stepExecution.getWriteSkipCount();
			 written += stepExecution.getWriteCount();
		 }
		 jobExecutionInfo.setRecordsRead(recordsRead);
		 jobExecutionInfo.setReadSkip(readSkip);
		 jobExecutionInfo.setProcessSkip(processSkip);
		 jobExecutionInfo.setWriteSkip(writeSkip);
		 jobExecutionInfo.setWritten(written);
	 }
	 Float total = new Float(0);

	 switch(jobExecution.getJobInstance().getJobName()) {
	 case "DarwinCoreArchiveHarvesting":
		 total = new Float(43);
		 break;
	 case "IdentificationKeyHarvesting":
		 total = new Float(10);
		 break;
	 case "IUCNImport":
		 total = new Float(11);
		 break;
	 case "GBIFImport":
		 total = new Float(10);
		 break;
	 case "PhylogeneticTreeHarvesting":
		 total = new Float(6);
		 break;
	 default:
		 break;
	 }

	 Float steps = new Float(jobExecution.getStepExecutions().size());
	 jobExecutionInfo.setProgress(Math.round((steps/ total) * 100f));
 }
 return jobExecutionInfo;
}
 
開發者ID:RBGKew,項目名稱:eMonocot,代碼行數:60,代碼來源:ResourceController.java


注:本文中的org.springframework.batch.core.JobExecution.getExitStatus方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。