for (int i = 0; i < numOfPartitions; i++) {
final StepExecutionImpl partitionExecution = isRestartNotOverride ? abortedPartitionExecutionsFromPrevious.get(i) : null;
final int partitionIndex = isRestartNotOverride ? partitionExecution.getPartitionId() : i;
final AbstractRunner<StepContextImpl> runner1;
final StepContextImpl stepContext1 = batchContext.clone();
final Step step1 = stepContext1.getStep();
final PropertyResolver resolver = new PropertyResolver();
if (partitionIndex >= 0 && partitionIndex < partitionProperties.length) {
resolver.setPartitionPlanProperties(partitionProperties[partitionIndex]);
//associate this partition represented by this StepExecutionImpl with this partition properties index. If this
//partition fails or is stopped, the restart process can select this partition properties.
stepContext1.getStepExecution().setPartitionId(partitionIndex);
} else {
//some partitioned steps may not have any partition properties
stepContext1.getStepExecution().setPartitionId(i);
}
resolver.setResolvePartitionPlanProperties(true);
resolver.resolve(step1);
if (isRestartNotOverride) {
stepContext1.setPersistentUserData(partitionExecution.getPersistentUserData());
stepContext1.getStepExecution().setReaderCheckpointInfo(partitionExecution.getReaderCheckpointInfo());
stepContext1.getStepExecution().setWriterCheckpointInfo(partitionExecution.getWriterCheckpointInfo());
}
if (isRestart && isOverride && reducer != null) {
reducer.rollbackPartitionedStep();
}
final Chunk ch = step1.getChunk();
if (ch == null) {
runner1 = new BatchletRunner(stepContext1, enclosingRunner, this, step1.getBatchlet());
} else {
runner1 = new ChunkRunner(stepContext1, enclosingRunner, this, ch);
}
if (i >= numOfThreads) {
completedPartitionThreads.take();
}
jobContext.getJobRepository().addPartitionExecution(stepExecution, stepContext1.getStepExecution());
jobContext.getBatchEnvironment().submitTask(runner1);
}
BatchStatus consolidatedBatchStatus = BatchStatus.STARTED;
final List<StepExecutionImpl> fromAllPartitions = new ArrayList<StepExecutionImpl>();