RESOLVED - issue BATCH-511: read failures cause rollback
Renamed "commit*" in StepContribution to "combine*". Fixed broken test (forgot to combine skip counts).
This commit is contained in:
@@ -101,13 +101,20 @@ public class StepContribution {
|
||||
* Increment the counter for skipped reads
|
||||
*/
|
||||
public void incrementReadSkipCount() {
|
||||
this.readSkipCount++;
|
||||
readSkipCount++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the read skips and transfer them to the total skip count
|
||||
* @return the read skip count
|
||||
*/
|
||||
public void commitReadSkipCount() {
|
||||
public int getReadSkipCount() {
|
||||
return readSkipCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Combine the skip counts and reset read skips to zero.
|
||||
*/
|
||||
public void combineSkipCounts() {
|
||||
skipCount += readSkipCount;
|
||||
readSkipCount = 0;
|
||||
}
|
||||
|
||||
@@ -304,9 +304,8 @@ public class StepExecution extends Entity {
|
||||
*/
|
||||
public synchronized void apply(StepContribution contribution) {
|
||||
itemCount += contribution.getItemCount();
|
||||
// TODO: this should not be necessary - the step decides
|
||||
// executionContext = contribution.getExecutionContext();
|
||||
commitCount += contribution.getCommitCount();
|
||||
contribution.combineSkipCounts();
|
||||
skipCount += contribution.getSkipCount();
|
||||
}
|
||||
|
||||
|
||||
@@ -299,7 +299,6 @@ public class ItemOrientedStep extends AbstractStep {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
|
||||
contribution.commitReadSkipCount();
|
||||
// Apply the contribution to the step
|
||||
// only if chunk was successful
|
||||
stepExecution.apply(contribution);
|
||||
|
||||
@@ -173,7 +173,7 @@ public class ItemSkipPolicyItemHandler extends SimpleItemHandler {
|
||||
catch (SkipLimitExceededException ex) {
|
||||
// we are headed for a abnormal ending so bake in the skip
|
||||
// count
|
||||
contribution.commitReadSkipCount();
|
||||
contribution.combineSkipCounts();
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user