|
38 | 38 | import org.springframework.batch.core.launch.JobOperator; |
39 | 39 | import org.springframework.batch.core.repository.JobRepository; |
40 | 40 | import org.springframework.batch.core.step.builder.ChunkOrientedStepBuilder; |
41 | | -import org.springframework.batch.core.step.skip.LimitCheckingItemSkipPolicy; |
| 41 | +import org.springframework.batch.core.step.skip.LimitCheckingExceptionHierarchySkipPolicy; |
42 | 42 | import org.springframework.batch.core.step.skip.SkipLimitExceededException; |
43 | 43 | import org.springframework.batch.item.ItemProcessor; |
44 | 44 | import org.springframework.batch.item.ItemReader; |
@@ -426,9 +426,10 @@ public Step faulTolerantChunkOrientedStep(JobRepository jobRepository, |
426 | 426 |
|
427 | 427 | // skip policy configuration |
428 | 428 | int skipLimit = Integer.parseInt(System.getProperty("skipLimit")); |
429 | | - Map<Class<? extends Throwable>, Boolean> skippableExceptions = Map.of(FlatFileParseException.class, true, |
430 | | - DataIntegrityViolationException.class, true); |
431 | | - LimitCheckingItemSkipPolicy skipPolicy = new LimitCheckingItemSkipPolicy(skipLimit, skippableExceptions); |
| 429 | + Set<Class<? extends Throwable>> skippableExceptions = Set.of(FlatFileParseException.class, |
| 430 | + DataIntegrityViolationException.class); |
| 431 | + LimitCheckingExceptionHierarchySkipPolicy skipPolicy = new LimitCheckingExceptionHierarchySkipPolicy( |
| 432 | + skippableExceptions, skipLimit); |
432 | 433 |
|
433 | 434 | return new ChunkOrientedStepBuilder<Person, Person>(jobRepository, 2).reader(itemReader) |
434 | 435 | .processor(itemProcessor) |
@@ -460,9 +461,10 @@ public Step concurrentFaulTolerantChunkOrientedStep(JobRepository jobRepository, |
460 | 461 |
|
461 | 462 | // skip policy configuration |
462 | 463 | int skipLimit = Integer.parseInt(System.getProperty("skipLimit")); |
463 | | - Map<Class<? extends Throwable>, Boolean> skippableExceptions = Map.of(FlatFileParseException.class, true, |
464 | | - DataIntegrityViolationException.class, true); |
465 | | - LimitCheckingItemSkipPolicy skipPolicy = new LimitCheckingItemSkipPolicy(skipLimit, skippableExceptions); |
| 464 | + Set<Class<? extends Throwable>> skippableExceptions = Set.of(FlatFileParseException.class, |
| 465 | + DataIntegrityViolationException.class); |
| 466 | + LimitCheckingExceptionHierarchySkipPolicy skipPolicy = new LimitCheckingExceptionHierarchySkipPolicy( |
| 467 | + skippableExceptions, skipLimit); |
466 | 468 |
|
467 | 469 | return new ChunkOrientedStepBuilder<Person, Person>(jobRepository, 2).reader(itemReader) |
468 | 470 | .processor(itemProcessor) |
|
0 commit comments