|
21 | 21 | import org.springframework.batch.core.BatchStatus;
|
22 | 22 | import org.springframework.batch.core.JobExecution;
|
23 | 23 | import org.springframework.batch.core.JobInstance;
|
24 |
| -import org.springframework.batch.core.JobParameter; |
25 | 24 | import org.springframework.batch.core.JobParameters;
|
26 | 25 | import org.springframework.batch.core.StepExecution;
|
27 | 26 | import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
|
|
54 | 53 | * @author Mahmoud Ben Hassine
|
55 | 54 | * @author Baris Cubukcuoglu
|
56 | 55 | * @author Parikshit Dutta
|
| 56 | + * @author Mark John Moreno |
57 | 57 | * @see JobRepository
|
58 | 58 | * @see JobInstanceDao
|
59 | 59 | * @see JobExecutionDao
|
@@ -151,15 +151,14 @@ public JobExecution createJobExecution(String jobName, JobParameters jobParamete
|
151 | 151 | + "The last execution ended with a failure that could not be rolled back, "
|
152 | 152 | + "so it may be dangerous to proceed. Manual intervention is probably necessary.");
|
153 | 153 | }
|
154 |
| - Collection<JobParameter<?>> allJobParameters = execution.getJobParameters().getParameters().values(); |
155 |
| - long identifyingJobParametersCount = allJobParameters.stream() |
156 |
| - .filter(JobParameter::isIdentifying) |
157 |
| - .count(); |
158 |
| - if (identifyingJobParametersCount > 0 |
| 154 | + JobParameters allJobParameters = execution.getJobParameters(); |
| 155 | + JobParameters identifyingJobParameters = new JobParameters(allJobParameters.getIdentifyingParameters()); |
| 156 | + if (!identifyingJobParameters.isEmpty() |
159 | 157 | && (status == BatchStatus.COMPLETED || status == BatchStatus.ABANDONED)) {
|
160 | 158 | throw new JobInstanceAlreadyCompleteException(
|
161 |
| - "A job instance already exists and is complete for parameters=" + jobParameters |
162 |
| - + ". If you want to run this job again, change the parameters."); |
| 159 | + "A job instance already exists and is complete for identifying parameters=" |
| 160 | + + identifyingJobParameters + ". If you want to run this job again, " |
| 161 | + + "change the parameters."); |
163 | 162 | }
|
164 | 163 | }
|
165 | 164 | executionContext = ecDao.getExecutionContext(jobExecutionDao.getLastJobExecution(jobInstance));
|
|
0 commit comments