diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/job/DefaultJobExecutor.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/job/DefaultJobExecutor.java index f2fa7a41a..1db48401f 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/job/DefaultJobExecutor.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/job/DefaultJobExecutor.java @@ -91,8 +91,7 @@ public class DefaultJobExecutor implements JobExecutor { updateStatus(execution, BatchStatus.STARTED); StepExecutor stepExecutor = stepExecutorFactory .getExecutor(step); - StepExecution stepExecution = new StepExecution(stepInstance, - execution); + StepExecution stepExecution = execution.createStepExecution(stepInstance); status = stepExecutor.process(step, stepExecution); } diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/GracefulShutdownFunctionalTest.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/GracefulShutdownFunctionalTest.java index 8fa4c0f7a..bf872a8dd 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/GracefulShutdownFunctionalTest.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/GracefulShutdownFunctionalTest.java @@ -67,16 +67,16 @@ public class GracefulShutdownFunctionalTest extends AbstractBatchLauncherTests { launcher.stop(); //it takes a little while for it to shut down. -// Thread.sleep(1000); -// -// assertFalse(launcher.isRunning()); -// assertFalse(jobThread.isAlive()); -// -// if (!errors.isEmpty()) { -// Exception e = (Exception) errors.get(0); -// e.printStackTrace(); -// fail("Unexpected Exception: "+e); -// } + Thread.sleep(1000); + + assertFalse(launcher.isRunning()); + assertFalse(jobThread.isAlive()); + + if (!errors.isEmpty()) { + Exception e = (Exception) errors.get(0); + e.printStackTrace(); + fail("Unexpected Exception: "+e); + } } }