protected void runFlow(final Flow flow, final CountDownLatch latch) {
final FlowContextImpl flowContext;
final AbstractContext[] outerContextsToUse = AbstractContext.addToContextArray(batchContext.getOuterContexts(), batchContext);
if (batchContext instanceof SplitContextImpl) {
final SplitContextImpl splitContext = (SplitContextImpl) batchContext;
outerContextsToUse[0] = splitContext.getJobContext().clone();
flowContext = new FlowContextImpl(flow, outerContextsToUse);
splitContext.getFlowExecutions().add(flowContext.getFlowExecution());
} else {
flowContext = new FlowContextImpl(flow, outerContextsToUse);
}
final FlowExecutionRunner flowExecutionRunner = new FlowExecutionRunner(flowContext, this, latch);