Skip to content

Commit

Permalink
Merge pull request #38327 from cachescrubber
Browse files Browse the repository at this point in the history
* pr/38327:
  Update JobLauncherApplicationRunner to use getIdentifyingParameters

Closes gh-38327
  • Loading branch information
mhalbritter committed Nov 13, 2023
2 parents 4d21760 + adb841c commit 212b80a
Showing 1 changed file with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Properties;
Expand Down Expand Up @@ -230,7 +229,8 @@ private JobParameters getNextJobParameters(Job job, JobParameters jobParameters)
private JobParameters getNextJobParametersForExisting(Job job, JobParameters jobParameters) {
JobExecution lastExecution = this.jobRepository.getLastJobExecution(job.getName(), jobParameters);
if (isStoppedOrFailed(lastExecution) && job.isRestartable()) {
JobParameters previousIdentifyingParameters = getGetIdentifying(lastExecution.getJobParameters());
JobParameters previousIdentifyingParameters = new JobParameters(
lastExecution.getJobParameters().getIdentifyingParameters());
return merge(previousIdentifyingParameters, jobParameters);
}
return jobParameters;
Expand All @@ -241,16 +241,6 @@ private boolean isStoppedOrFailed(JobExecution execution) {
return (status == BatchStatus.STOPPED || status == BatchStatus.FAILED);
}

private JobParameters getGetIdentifying(JobParameters parameters) {
HashMap<String, JobParameter<?>> nonIdentifying = new LinkedHashMap<>(parameters.getParameters().size());
parameters.getParameters().forEach((key, value) -> {
if (value.isIdentifying()) {
nonIdentifying.put(key, value);
}
});
return new JobParameters(nonIdentifying);
}

private JobParameters merge(JobParameters parameters, JobParameters additionals) {
Map<String, JobParameter<?>> merged = new LinkedHashMap<>();
merged.putAll(parameters.getParameters());
Expand Down

0 comments on commit 212b80a

Please sign in to comment.