RESOLVED - issue BATCH-1399: Expose StepExecutionAggregator as a strategy interface in PartitionStep

This commit is contained in:
dsyer
2009-09-11 09:38:25 +00:00
parent 0cc68d71b8
commit be7cea1603
2 changed files with 19 additions and 14 deletions

View File

@@ -19,6 +19,7 @@ package org.springframework.batch.core.partition.support;
import java.util.Collection;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepExecution;
import org.springframework.util.Assert;
@@ -32,11 +33,14 @@ import org.springframework.util.Assert;
public class DefaultStepExecutionAggregator implements StepExecutionAggregator {
/**
* Aggregates the status and exit status using their built in combination
* rules (i.e. {@link BatchStatus#max(BatchStatus, BatchStatus) max} and
* {@link ExitStatus#and(ExitStatus) and} respectively), and the counters by
* simple arithmetic.
*
* Aggregates the input executions into the result {@link StepExecution}.
* The aggregated fields are
* <ul>
* <li>status - choosing the highest value using
* {@link BatchStatus#max(BatchStatus, BatchStatus)}</li>
* <li>exitStatus - using {@link ExitStatus#and(ExitStatus)}</li>
* <li>commitCount, rollbackCount, etc. - by arithmetic sum</li>
* </ul>
* @see StepExecutionAggregator #aggregate(StepExecution, Collection)
*/
public void aggregate(StepExecution result, Collection<StepExecution> executions) {

View File

@@ -2,20 +2,21 @@ package org.springframework.batch.core.partition.support;
import java.util.Collection;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepExecution;
/**
* Strategy for a aggregating step executions, usually when they are the result
* of partitioned or remote execution.
*
* @author Dave Syer
*
* @since 2.1
*
*/
public interface StepExecutionAggregator {
/**
* Take the inputs and aggregate certain fields, putting the aggregates into
* the result. The aggregated fields are
* <ul>
* <li>status - choosing the highest value using {@link BatchStatus#max(BatchStatus, BatchStatus)}</li>
* <li>exitStatus - using {@link ExitStatus#and(ExitStatus)}</li>
* <li>commitCount, rollbackCount, etc. - by arithmetic sum</li>
* </ul>
* Take the inputs and aggregate, putting the aggregates into the result.
*
* @param result the result to overwrite
* @param executions the inputs