RESOLVED - issue BATCH-1518: Add optimization for commit-interval=1

This commit is contained in:
dsyer
2010-03-01 10:21:57 +00:00
parent 598301de8d
commit b6aca5fa05
3 changed files with 40 additions and 10 deletions

View File

@@ -208,7 +208,7 @@ public class FaultTolerantChunkProcessor<I, O> extends SimpleChunkProcessor<I, O
O output = null;
try {
count.incrementAndGet();
O cached = (cacheIterator != null&& cacheIterator.hasNext()) ? cacheIterator.next() : null;
O cached = (cacheIterator != null && cacheIterator.hasNext()) ? cacheIterator.next() : null;
if (cached != null && count.get() > scanLimit) {
/*
* If there is a cached chunk then we must be
@@ -221,7 +221,7 @@ public class FaultTolerantChunkProcessor<I, O> extends SimpleChunkProcessor<I, O
}
else {
output = doProcess(item);
if (!processorTransactional) {
if (!processorTransactional) {
cache.add(output);
}
}
@@ -377,6 +377,12 @@ public class FaultTolerantChunkProcessor<I, O> extends SimpleChunkProcessor<I, O
"Retry exhausted after last attempt in recovery path, but exception is not skippable.",
context.getLastThrowable());
}
if (inputs.size()==1 && outputs.getSkips().isEmpty()) {
// Optimization for trivial chunk size: no need to scan
checkSkipPolicy(inputs.iterator(), outputs.iterator(), context.getLastThrowable(), contribution);
return null;
}
inputs.setBusy(true);
scan(contribution, inputs, outputs, chunkMonitor);