Polish JobLauncherCommandLineRunner
The JobLauncherCommandLineRunner reassigned method arguments inside the merge method. Instead of reassigning the method argument just return the new instance directly. Also some minor cleanup (unnesseccary null check and continue keyword). Closes gh-10612
This commit is contained in:
parent
51551feace
commit
ab3d65ccae
|
@ -181,8 +181,7 @@ public class JobLauncherCommandLineRunner
|
||||||
Map<String, JobParameter> merged = new HashMap<String, JobParameter>();
|
Map<String, JobParameter> merged = new HashMap<String, JobParameter>();
|
||||||
merged.putAll(parameters.getParameters());
|
merged.putAll(parameters.getParameters());
|
||||||
merged.putAll(additionals);
|
merged.putAll(additionals);
|
||||||
parameters = new JobParameters(merged);
|
return new JobParameters(merged);
|
||||||
return parameters;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void executeRegisteredJobs(JobParameters jobParameters)
|
private void executeRegisteredJobs(JobParameters jobParameters)
|
||||||
|
@ -199,7 +198,6 @@ public class JobLauncherCommandLineRunner
|
||||||
}
|
}
|
||||||
catch (NoSuchJobException ex) {
|
catch (NoSuchJobException ex) {
|
||||||
logger.debug("No job found in registry for job name: " + jobName);
|
logger.debug("No job found in registry for job name: " + jobName);
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,13 +208,11 @@ public class JobLauncherCommandLineRunner
|
||||||
JobInstanceAlreadyCompleteException, JobParametersInvalidException,
|
JobInstanceAlreadyCompleteException, JobParametersInvalidException,
|
||||||
JobParametersNotFoundException {
|
JobParametersNotFoundException {
|
||||||
JobParameters nextParameters = getNextJobParameters(job, jobParameters);
|
JobParameters nextParameters = getNextJobParameters(job, jobParameters);
|
||||||
if (nextParameters != null) {
|
|
||||||
JobExecution execution = this.jobLauncher.run(job, nextParameters);
|
JobExecution execution = this.jobLauncher.run(job, nextParameters);
|
||||||
if (this.publisher != null) {
|
if (this.publisher != null) {
|
||||||
this.publisher.publishEvent(new JobExecutionEvent(execution));
|
this.publisher.publishEvent(new JobExecutionEvent(execution));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void executeLocalJobs(JobParameters jobParameters)
|
private void executeLocalJobs(JobParameters jobParameters)
|
||||||
throws JobExecutionException {
|
throws JobExecutionException {
|
||||||
|
|
Loading…
Reference in New Issue