}
latch.await();
//check FlowResults from each flow
final List<FlowExecutionImpl> fes = batchContext.getFlowExecutions();
FlowExecutionImpl failedFlow = null;
FlowExecutionImpl stoppedFlow = null;
FlowExecutionImpl endedFlow = null;
for (int i = 0; i < fes.size(); i++) {
final FlowExecutionImpl flowExecution = fes.get(i);
if (flowExecution.getBatchStatus() == BatchStatus.FAILED) {
failedFlow = flowExecution;
break;
} else if (flowExecution.getBatchStatus() == BatchStatus.STOPPED) {
stoppedFlow = flowExecution;
} else if (flowExecution.getBatchStatus() == BatchStatus.COMPLETED) {
if (flowExecution.isEnded()) {
endedFlow = flowExecution;
}
}
}