BATCH-2442: fix infinite loop when item processor fails during a scan

Currently, when the processor throws an exception during a scan, the
chunk is never marked as complete and the step never finishes. Moreover,
items that were processed unsuccessfully are still written.

This commit fixes the issue by excluding failed items from the scan.

Resolves BATCH-2442
This commit is contained in:
Mahmoud Ben Hassine
2018-03-27 14:07:27 +02:00
parent ea6c312344
commit c1b79e5946
2 changed files with 60 additions and 1 deletions

View File

@@ -580,6 +580,14 @@ public class FaultTolerantChunkProcessor<I, O> extends SimpleChunkProcessor<I, O
Chunk<I>.ChunkIterator inputIterator = inputs.iterator();
Chunk<O>.ChunkIterator outputIterator = outputs.iterator();
//BATCH-2442 : do not scan skipped items
if (!inputs.getSkips().isEmpty()) {
if (outputIterator.hasNext()) {
outputIterator.remove();
return;
}
}
List<O> items = Collections.singletonList(outputIterator.next());
inputIterator.next();
try {