1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.batch.core.partition.support;
18
19 import java.util.Collection;
20
21 import org.springframework.batch.core.BatchStatus;
22 import org.springframework.batch.core.ExitStatus;
23 import org.springframework.batch.core.StepExecution;
24 import org.springframework.util.Assert;
25
26
27
28
29
30
31
32
33 public class DefaultStepExecutionAggregator implements StepExecutionAggregator {
34
35
36
37
38
39
40
41
42
43
44
45
46 @Override
47 public void aggregate(StepExecution result, Collection<StepExecution> executions) {
48 Assert.notNull(result, "To aggregate into a result it must be non-null.");
49 if (executions == null) {
50 return;
51 }
52 for (StepExecution stepExecution : executions) {
53 BatchStatus status = stepExecution.getStatus();
54 result.setStatus(BatchStatus.max(result.getStatus(), status));
55 result.setExitStatus(result.getExitStatus().and(stepExecution.getExitStatus()));
56 result.setCommitCount(result.getCommitCount() + stepExecution.getCommitCount());
57 result.setRollbackCount(result.getRollbackCount() + stepExecution.getRollbackCount());
58 result.setReadCount(result.getReadCount() + stepExecution.getReadCount());
59 result.setReadSkipCount(result.getReadSkipCount() + stepExecution.getReadSkipCount());
60 result.setWriteCount(result.getWriteCount() + stepExecution.getWriteCount());
61 result.setWriteSkipCount(result.getWriteSkipCount() + stepExecution.getWriteSkipCount());
62 }
63 }
64
65 }