IN PROGRESS - issue BATCH-461: skip counting
http://jira.springframework.org/browse/BATCH-461 StepContribution#getSkipCount renamed to StepContribution#getStepSkipCount and added StepContribution#getContributionSkipCount (used by StepExecution to increment its skipCount).
This commit is contained in:
@@ -33,7 +33,7 @@ public class StepContribution {
|
||||
private ExecutionContext executionContext;
|
||||
|
||||
private int commitCount;
|
||||
|
||||
|
||||
private int skipCount;
|
||||
|
||||
/**
|
||||
@@ -98,12 +98,25 @@ public class StepContribution {
|
||||
public boolean isTerminateOnly() {
|
||||
return execution.isTerminateOnly();
|
||||
}
|
||||
|
||||
public int getSkipCount() {
|
||||
|
||||
/**
|
||||
* @return the sum of skips accumulated in the parent {@link StepExecution}
|
||||
* and this <code>StepContribution</code>.
|
||||
*/
|
||||
public int getStepSkipCount() {
|
||||
return skipCount + execution.getSkipCount();
|
||||
}
|
||||
|
||||
public void incrementSkipCount(){
|
||||
|
||||
/**
|
||||
* @return the number of skips collected in this
|
||||
* <code>StepContribution</code> (not including skips accumulated in the
|
||||
* parent {@link StepExecution}.
|
||||
*/
|
||||
public int getContributionSkipCount() {
|
||||
return skipCount;
|
||||
}
|
||||
|
||||
public void incrementSkipCount() {
|
||||
skipCount++;
|
||||
}
|
||||
|
||||
|
||||
@@ -307,7 +307,7 @@ public class StepExecution extends Entity {
|
||||
// TODO: this should not be necessary - the step decides
|
||||
// executionContext = contribution.getExecutionContext();
|
||||
commitCount += contribution.getCommitCount();
|
||||
skipCount += contribution.getSkipCount();
|
||||
skipCount += contribution.getContributionSkipCount();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ItemSkipPolicyItemHandler extends SimpleItemHandler {
|
||||
return getItemReader().read();
|
||||
}
|
||||
catch (Exception e) {
|
||||
if (itemSkipPolicy.shouldSkip(e, contribution.getSkipCount())) {
|
||||
if (itemSkipPolicy.shouldSkip(e, contribution.getStepSkipCount())) {
|
||||
contribution.incrementSkipCount();
|
||||
if (getItemReader() instanceof Skippable) {
|
||||
((Skippable) getItemReader()).skip();
|
||||
@@ -87,7 +87,7 @@ public class ItemSkipPolicyItemHandler extends SimpleItemHandler {
|
||||
getItemWriter().write(item);
|
||||
}
|
||||
catch (Exception e) {
|
||||
if (itemSkipPolicy.shouldSkip(e, contribution.getSkipCount())) {
|
||||
if (itemSkipPolicy.shouldSkip(e, contribution.getStepSkipCount())) {
|
||||
contribution.incrementSkipCount();
|
||||
if (getItemReader() instanceof Skippable) {
|
||||
((Skippable) getItemReader()).skip();
|
||||
|
||||
Reference in New Issue
Block a user