REOPENED - BATCH-896: "DRY" FaultTolerantTasklet implementations
cleaned up the execute methods
This commit is contained in:
@@ -97,22 +97,18 @@ public class FaultTolerantChunkOrientedTasklet<I, O> extends AbstractFaultTolera
|
||||
}
|
||||
});
|
||||
|
||||
// If there is no input we don't have to do anything more
|
||||
if (inputs.isEmpty()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Map<I, Exception> skippedInputs = getBufferedSkips(attributes, SKIPPED_INPUTS_KEY);
|
||||
final Map<I, Exception> skippedInputs = getBufferedSkips(attributes, SKIPPED_INPUTS_KEY);
|
||||
final Map<O, Exception> skippedOutputs = getBufferedSkips(attributes, SKIPPED_OUTPUTS_KEY);
|
||||
|
||||
if (!inputs.isEmpty()) {
|
||||
inputs.removeAll(skippedInputs.keySet());
|
||||
process(contribution, inputs, outputs, skippedInputs);
|
||||
}
|
||||
|
||||
Map<O, Exception> skippedOutputs = getBufferedSkips(attributes, SKIPPED_OUTPUTS_KEY);
|
||||
outputs.removeAll(skippedOutputs.keySet());
|
||||
write(outputs, contribution, skippedOutputs);
|
||||
outputs.removeAll(skippedOutputs.keySet());
|
||||
write(outputs, contribution, skippedOutputs);
|
||||
}
|
||||
|
||||
callSkipListeners(skippedReads, skippedInputs, skippedOutputs);
|
||||
|
||||
@@ -122,10 +118,6 @@ public class FaultTolerantChunkOrientedTasklet<I, O> extends AbstractFaultTolera
|
||||
attributes.removeAttribute(key);
|
||||
}
|
||||
|
||||
inputs.clear();
|
||||
skippedInputs.clear();
|
||||
skippedOutputs.clear();
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
@@ -69,21 +69,19 @@ public class NonbufferingFaultTolerantChunkOrientedTasklet<I, O> extends
|
||||
|
||||
// filter inputs marked for skipping
|
||||
final Map<I, Exception> skippedInputs = getBufferedSkips(attributes, SKIPPED_INPUTS_KEY);
|
||||
inputs.removeAll(skippedInputs.keySet());
|
||||
|
||||
// If there is no input we don't have to do anything more
|
||||
if (inputs.isEmpty()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
final List<O> outputs = new ArrayList<O>();
|
||||
process(contribution, inputs, outputs, skippedInputs);
|
||||
|
||||
// filter outputs marked for skipping
|
||||
final Map<O, Exception> skippedOutputs = getBufferedSkips(attributes, SKIPPED_OUTPUTS_KEY);
|
||||
outputs.removeAll(skippedOutputs.keySet());
|
||||
|
||||
write(outputs, contribution, skippedOutputs);
|
||||
if (!inputs.isEmpty()) {
|
||||
inputs.removeAll(skippedInputs.keySet());
|
||||
|
||||
final List<O> outputs = new ArrayList<O>();
|
||||
process(contribution, inputs, outputs, skippedInputs);
|
||||
|
||||
// filter outputs marked for skipping
|
||||
outputs.removeAll(skippedOutputs.keySet());
|
||||
|
||||
write(outputs, contribution, skippedOutputs);
|
||||
}
|
||||
|
||||
callSkipListeners(skippedReads, skippedInputs, skippedOutputs);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user