当前位置: 首页>>代码示例>>Java>>正文


Java JobParametersIncrementer类代码示例

本文整理汇总了Java中org.springframework.batch.core.JobParametersIncrementer的典型用法代码示例。如果您正苦于以下问题:Java JobParametersIncrementer类的具体用法?Java JobParametersIncrementer怎么用?Java JobParametersIncrementer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JobParametersIncrementer类属于org.springframework.batch.core包,在下文中一共展示了JobParametersIncrementer类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNextJobParameters

import org.springframework.batch.core.JobParametersIncrementer; //导入依赖的package包/类
/**
 * Borrowed from CommandLineJobRunner.
 * @param job the job that we need to find the next parameters for
 * @return the next job parameters if they can be located
 * @throws JobParametersNotFoundException if there is a problem
 */
private JobParameters getNextJobParameters(Job job) throws JobParametersNotFoundException {
	String jobIdentifier = job.getName();
	JobParameters jobParameters;
	List<JobInstance> lastInstances = jobExplorer.getJobInstances(jobIdentifier, 0, 1);

	JobParametersIncrementer incrementer = job.getJobParametersIncrementer();

	if (lastInstances.isEmpty()) {
		jobParameters = incrementer.getNext(new JobParameters());
		if (jobParameters == null) {
			throw new JobParametersNotFoundException("No bootstrap parameters found from incrementer for job="
					+ jobIdentifier);
		}
	}
	else {
		List<JobExecution> lastExecutions = jobExplorer.getJobExecutions(lastInstances.get(0));
		jobParameters = incrementer.getNext(lastExecutions.get(0).getJobParameters());
	}
	return jobParameters;
}
 
开发者ID:codecentric,项目名称:spring-boot-starter-batch-web,代码行数:27,代码来源:JobOperationsController.java

示例2: getNextJobParameters

import org.springframework.batch.core.JobParametersIncrementer; //导入依赖的package包/类
/**
 * 다음 실행 될 Batch Job의 Job Parameter를 생성한다.
 * 
 * @param job
 * @return JobParameters
 * @throws JobParametersNotFoundException 
 */
private JobParameters getNextJobParameters(Job job) throws JobParametersNotFoundException {
	String jobIdentifier = job.getName();
	JobParameters jobParameters;
	List<JobInstance> lastInstances = jobExplorer.getJobInstances(jobIdentifier, 0, 1);

	JobParametersIncrementer incrementer = job.getJobParametersIncrementer();
	if (incrementer == null) {
		throw new JobParametersNotFoundException("No job parameters incrementer found for job=" + jobIdentifier);
	}

	if (lastInstances.isEmpty()) {
		jobParameters = incrementer.getNext(new JobParameters());
		if (jobParameters == null) {
			throw new JobParametersNotFoundException("No bootstrap parameters found from incrementer for job="
					+ jobIdentifier);
		}
	}
	else {
		jobParameters = incrementer.getNext(lastInstances.get(0).getJobParameters());
	}
	return jobParameters;
}
 
开发者ID:eGovFrame,项目名称:egovframework.rte.root,代码行数:30,代码来源:EgovCommandLineRunner.java

示例3: getNextJobParameters

import org.springframework.batch.core.JobParametersIncrementer; //导入依赖的package包/类
private JobParameters getNextJobParameters(Job job,
		JobParameters additionalParameters) {
	String name = job.getName();
	JobParameters parameters = new JobParameters();
	List<JobInstance> lastInstances = this.jobExplorer.getJobInstances(name, 0, 1);
	JobParametersIncrementer incrementer = job.getJobParametersIncrementer();
	Map<String, JobParameter> additionals = additionalParameters.getParameters();
	if (lastInstances.isEmpty()) {
		// Start from a completely clean sheet
		if (incrementer != null) {
			parameters = incrementer.getNext(new JobParameters());
		}
	}
	else {
		List<JobExecution> previousExecutions = this.jobExplorer
				.getJobExecutions(lastInstances.get(0));
		JobExecution previousExecution = previousExecutions.get(0);
		if (previousExecution == null) {
			// Normally this will not happen - an instance exists with no executions
			if (incrementer != null) {
				parameters = incrementer.getNext(new JobParameters());
			}
		}
		else if (isStoppedOrFailed(previousExecution) && job.isRestartable()) {
			// Retry a failed or stopped execution
			parameters = previousExecution.getJobParameters();
			// Non-identifying additional parameters can be removed to a retry
			removeNonIdentifying(additionals);
		}
		else if (incrementer != null) {
			// New instance so increment the parameters if we can
			parameters = incrementer.getNext(previousExecution.getJobParameters());
		}
	}
	return merge(parameters, additionals);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:37,代码来源:JobLauncherCommandLineRunner.java

示例4: getNextJobParameters

import org.springframework.batch.core.JobParametersIncrementer; //导入依赖的package包/类
private JobParameters getNextJobParameters(final String jobName) throws NoSuchJobException, JobParametersNotFoundException {
	final Job job = jobRegistry.getJob(jobName);
	final JobParametersIncrementer incrementer = Optional.ofNullable(job.getJobParametersIncrementer()).orElseThrow(
			() -> new JobParametersNotFoundException("No job parameters incrementer found for job " + jobName));

	return getNextJobParameters(jobName, incrementer);
}
 
开发者ID:phjardas,项目名称:spring-batch-tools,代码行数:8,代码来源:BatchOperatorImpl.java

示例5: testJob

import org.springframework.batch.core.JobParametersIncrementer; //导入依赖的package包/类
@Bean
public Job testJob() {
	final JobParametersIncrementer incrementer = new RunIdIncrementer();

	return jobs.get(JOB_NAME) //
			.incrementer(incrementer) //
			.start(taskletStep()) //
			.next(chunkStep()) //
			.build();
}
 
开发者ID:phjardas,项目名称:spring-batch-tools,代码行数:11,代码来源:TestJobConfig.java

示例6: getJobParametersIncrementer

import org.springframework.batch.core.JobParametersIncrementer; //导入依赖的package包/类
@Override
public JobParametersIncrementer getJobParametersIncrementer() {
	return null;
}
 
开发者ID:marklogic-community,项目名称:marklogic-spring-batch,代码行数:5,代码来源:JobSupport.java


注:本文中的org.springframework.batch.core.JobParametersIncrementer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。