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


Java JobExecution.getStatus方法代碼示例

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


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

示例1: JobExecutionInfo

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
public JobExecutionInfo(JobExecution jobExecution, String baseUrl) {
	resourceIdentifier = jobExecution.getJobInstance().getJobParameters().getString("resource.identifier");
	DateTime sTime = new DateTime(jobExecution.getStartTime());
	DateTime eTime = new DateTime(jobExecution.getEndTime());
	duration = eTime.minus(sTime.getMillis());
	startTime = sTime;
	exitDescription = jobExecution.getExitStatus().getExitDescription();
	exitCode = jobExecution.getExitStatus().getExitCode();
	id = jobExecution.getId();
	jobInstance = baseUrl + "/jobs/"	+ jobExecution.getJobInstance().getJobName() + "/"	+ jobExecution.getJobInstance().getId();
	resource = baseUrl + "/jobs/executions/"	+ jobExecution.getId();
	this.baseUrl = baseUrl;
	status = jobExecution.getStatus();

	Integer writeSkip = 0;
	for (StepExecution stepExecution : jobExecution.getStepExecutions()) {
		recordsRead += stepExecution.getReadCount();
		readSkip += stepExecution.getReadSkipCount();
		processSkip += stepExecution.getProcessSkipCount();
		written += stepExecution.getWriteCount();
		writeSkip += stepExecution.getWriteSkipCount();
	}
}
 
開發者ID:RBGKew,項目名稱:eMonocot,代碼行數:24,代碼來源:JobExecutionInfo.java

示例2: AdaptedJobExecution

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
public AdaptedJobExecution(JobExecution jobExecution) {
    this.id = jobExecution.getId();
    if (jobExecution.getVersion() == null) {
        jobExecution.setVersion(0);
    } else {
        this.version = jobExecution.getVersion();
    }
    this.jobInstance = jobExecution.getJobInstance();
    this.jobParameters = jobExecution.getJobParameters();
    this.createDateTime = jobExecution.getCreateTime();
    this.endDateTime = jobExecution.getEndTime();
    this.lastUpdatedDateTime = jobExecution.getLastUpdated();
    this.startDateTime = jobExecution.getStartTime();
    if (jobExecution.getStatus() == null) {
        this.status = BatchStatus.STARTING.toString();
    } else {
        this.status = jobExecution.getStatus().toString();
    }
    this.exitStatus = jobExecution.getExitStatus().toString();
    for (StepExecution step : jobExecution.getStepExecutions()) {
        stepExecutions.add(step);
    }
    this.executionContext = jobExecution.getExecutionContext();
}
 
開發者ID:marklogic-community,項目名稱:marklogic-spring-batch,代碼行數:25,代碼來源:AdaptedJobExecution.java

示例3: JobExecutionInfo

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
public JobExecutionInfo(JobExecution jobExecution) {
	DateTime sTime = new DateTime(jobExecution.getStartTime());
	DateTime eTime = new DateTime(jobExecution.getEndTime());
	duration = eTime.minus(sTime.getMillis());
	startTime = sTime;
	exitDescription = jobExecution.getExitStatus().getExitDescription();
	exitCode = jobExecution.getExitStatus().getExitCode();
	id = jobExecution.getId();
	status = jobExecution.getStatus();
	jobConfigurationId = jobExecution.getJobParameters().getString("job.configuration.id");

	Integer writeSkip = 0;
	for (StepExecution stepExecution : jobExecution.getStepExecutions()) {
		recordsRead += stepExecution.getReadCount();
		readSkip += stepExecution.getReadSkipCount();
		processSkip += stepExecution.getProcessSkipCount();
		written += stepExecution.getWriteCount();
		writeSkip += stepExecution.getWriteSkipCount();
	}
}
 
開發者ID:RBGKew,項目名稱:powop,代碼行數:21,代碼來源:JobExecutionInfo.java

示例4: 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

示例5: afterJob

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
@Override
public void afterJob(JobExecution jobExecution) {
    if(jobExecution.getStatus() == BatchStatus.COMPLETED) {
        logger.info("!!! JOB FINISHED! LAST POSTID IMPORTED: " +
                jobExecution.getExecutionContext().get("postId") );
    }
}
 
開發者ID:mintster,項目名稱:nixmash-blog,代碼行數:8,代碼來源:DemoJobListener.java

示例6: 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

示例7: afterJob

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
@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());
}
 
開發者ID:namics,項目名稱:spring-batch-support,代碼行數:29,代碼來源:FailedJobExecutionListener.java

示例8: afterJob

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
@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");
    }
}
 
開發者ID:appstatus,項目名稱:appstatus-spring-boot-starter,代碼行數:13,代碼來源:OneExecutionListener.java

示例9: afterJob

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
@Override
public void afterJob(JobExecution jobExecution) {
	if (jobExecution.getStatus() == BatchStatus.COMPLETED) {
		log.info("!!! JOB FINISHED! Time to verify the results");

		List<Person> results = personDao.findAll();

		for (Person person : results) {
			log.info("Found <" + person + "> in the database.");
		}

	}
}
 
開發者ID:lospatitos,項目名稱:springboot-batch-doma,代碼行數:14,代碼來源:JobCompletionNotificationListener.java

示例10: isJobExecutionRestartable

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
/**
 * Determine whether the provided {@link JobExecution} is restartable.
 *
 * @param jobExecution Must not be null and its {@link BatchStatus} must not be null
 * either.
 * @return Never returns null
 */
public static boolean isJobExecutionRestartable(JobExecution jobExecution) {
	Assert.notNull(jobExecution, "The provided jobExecution must not be null.");

	final BatchStatus batchStatus = jobExecution.getStatus();
	Assert.notNull(batchStatus, "The BatchStatus of the provided jobExecution must not be null.");

	return batchStatus.isGreaterThan(BatchStatus.STOPPING) && batchStatus.isLessThan(BatchStatus.ABANDONED);
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-dataflow,代碼行數:16,代碼來源:JobUtils.java

示例11: isJobExecutionAbandonable

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
/**
 * Determine whether the provided {@link JobExecution} is abandonable.
 *
 * @param jobExecution Must not be null and its {@link BatchStatus} must not be null
 * either.
 * @return Never returns null
 */
public static boolean isJobExecutionAbandonable(JobExecution jobExecution) {
	Assert.notNull(jobExecution, "The provided jobExecution must not be null.");

	final BatchStatus batchStatus = jobExecution.getStatus();
	Assert.notNull(batchStatus, "The BatchStatus of the provided jobExecution must not be null.");

	return batchStatus.isGreaterThan(BatchStatus.STARTED) && batchStatus != BatchStatus.ABANDONED;
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-dataflow,代碼行數:16,代碼來源:JobUtils.java

示例12: isJobExecutionStoppable

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
/**
 * Determine whether the provided {@link JobExecution} is stoppable.
 *
 * @param jobExecution Must not be null and its {@link BatchStatus} must not be null
 * either.
 * @return Never returns null
 */
public static boolean isJobExecutionStoppable(JobExecution jobExecution) {
	Assert.notNull(jobExecution, "The provided jobExecution must not be null.");

	final BatchStatus batchStatus = jobExecution.getStatus();
	Assert.notNull(batchStatus, "The BatchStatus of the provided jobExecution must not be null.");

	return batchStatus.isLessThan(BatchStatus.STOPPING) && batchStatus != BatchStatus.COMPLETED;
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-dataflow,代碼行數:16,代碼來源:JobUtils.java

示例13: afterJob

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
@Override
public void afterJob(JobExecution jobExecution) {
    if (jobExecution.getStatus() == BatchStatus.COMPLETED) {
        log.info("+++ job finished!");
        jdbcTemplate
                .query("SELECT login, passwd, age FROM person", (RowMapper<Person>) (rs, row) -> new Person(rs.getString(1), rs.getString(2), rs.getInt(3)))
                .stream().forEach(p -> log.info("Found {} in the ds", p));

    }
}
 
開發者ID:przodownikR1,項目名稱:springBatchJmsKata,代碼行數:11,代碼來源:JobCompletionNotificationListener.java

示例14: afterJob

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
@Override
public void afterJob(JobExecution jobExecution) {
    if (jobExecution.getStatus() == BatchStatus.COMPLETED) {
        log.debug("Ticket import job completed.");
        metrics.stream()
                .map(metric -> String.format("%s = %s", metric.getMetricName(), metric.getMetricValue()))
                .forEach(log::debug);
    }
}
 
開發者ID:create1st,項目名稱:spring-batch,代碼行數:10,代碼來源:TicketImportJobExecutionListener.java

示例15: afterJob

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
@Override
public void afterJob(JobExecution jobExecution) {
   	if(jobExecution.getStatus() == BatchStatus.COMPLETED) {
   		logger.info("Job execution was successful");
   	}else {
   		logger.info("Job failed with status {}",jobExecution.getStatus() );
   	}
   }
 
開發者ID:SoatGroup,項目名稱:json-file-itemwriter,代碼行數:9,代碼來源:JobCompletionNotificationListener.java


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