BATCH-1064: Changed BatchStatus.FAILED to BatchStatus.INCOMPLETE where necessary
This commit is contained in:
@@ -241,8 +241,8 @@ public abstract class AbstractJob implements Job, StepLocator, BeanNameAware, In
|
||||
|
||||
// The job was already stopped before we even got this far. Deal
|
||||
// with it in the same way as any other interruption.
|
||||
execution.setStatus(BatchStatus.FAILED);
|
||||
execution.setExitStatus(ExitStatus.COMPLETED);
|
||||
execution.setExitStatus(ExitStatus.FAILED);
|
||||
execution.setStatus(BatchStatus.INCOMPLETE);
|
||||
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ public abstract class AbstractJob implements Job, StepLocator, BeanNameAware, In
|
||||
* @return the {@link StepExecution} corresponding to this step
|
||||
*
|
||||
* @throws JobInterruptedException if the {@link JobExecution} has been
|
||||
* interrupted, and in particular if {@link BatchStatus#FAILED} or
|
||||
* interrupted, and in particular if {@link BatchStatus#INCOMPLETE} or
|
||||
* {@link BatchStatus#STOPPING} is detected
|
||||
* @throws StartLimitExceededException if the start limit has been exceeded
|
||||
* for this step
|
||||
@@ -331,8 +331,7 @@ public abstract class AbstractJob implements Job, StepLocator, BeanNameAware, In
|
||||
|
||||
jobRepository.updateExecutionContext(execution);
|
||||
|
||||
if (currentStepExecution.getStatus() == BatchStatus.FAILED
|
||||
|| currentStepExecution.getStatus() == BatchStatus.STOPPING) {
|
||||
if (currentStepExecution.getStatus() == BatchStatus.STOPPING) {
|
||||
throw new JobInterruptedException("Job interrupted by step execution");
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ public abstract class AbstractStep implements Step, InitializingBean, BeanNameAw
|
||||
|
||||
// Check if someone is trying to stop us
|
||||
if (stepExecution.isTerminateOnly()) {
|
||||
stepExecution.setStatus(BatchStatus.FAILED);
|
||||
stepExecution.setStatus(BatchStatus.INCOMPLETE);
|
||||
throw new JobInterruptedException("JobExecution interrupted.");
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ public abstract class AbstractStep implements Step, InitializingBean, BeanNameAw
|
||||
return BatchStatus.UNKNOWN;
|
||||
}
|
||||
else if (e instanceof JobInterruptedException || e.getCause() instanceof JobInterruptedException) {
|
||||
return BatchStatus.FAILED;
|
||||
return BatchStatus.INCOMPLETE;
|
||||
}
|
||||
else {
|
||||
return BatchStatus.INCOMPLETE;
|
||||
|
||||
@@ -257,7 +257,7 @@ public class TaskletStep extends AbstractStep {
|
||||
locked = true;
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
stepExecution.setStatus(BatchStatus.FAILED);
|
||||
stepExecution.setStatus(BatchStatus.INCOMPLETE);
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
|
||||
|
||||
@@ -352,7 +352,7 @@ public class SimpleJobTests {
|
||||
job.execute(jobExecution);
|
||||
|
||||
assertEquals(0, list.size());
|
||||
checkRepository(BatchStatus.FAILED, ExitStatus.NOOP);
|
||||
checkRepository(BatchStatus.INCOMPLETE, ExitStatus.NOOP);
|
||||
ExitStatus exitStatus = jobExecution.getExitStatus();
|
||||
assertEquals(ExitStatus.NOOP.getExitCode(), exitStatus.getExitCode());
|
||||
}
|
||||
@@ -548,7 +548,7 @@ public class SimpleJobTests {
|
||||
}
|
||||
if (exception instanceof JobInterruptedException) {
|
||||
stepExecution.setExitStatus(ExitStatus.FAILED);
|
||||
stepExecution.setStatus(BatchStatus.FAILED);
|
||||
stepExecution.setStatus(BatchStatus.STOPPING);
|
||||
stepExecution.addFailureException(exception);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ public class AbstractStepTests {
|
||||
tested.setStepExecutionListeners(new StepExecutionListener[] { listener1, listener2 });
|
||||
|
||||
tested.execute(execution);
|
||||
assertEquals(BatchStatus.FAILED, execution.getStatus());
|
||||
assertEquals(BatchStatus.INCOMPLETE, execution.getStatus());
|
||||
Throwable expected = execution.getFailureExceptions().get(0);
|
||||
assertEquals("JobExecution interrupted.", expected.getMessage());
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ public class TaskletStepExceptionTests {
|
||||
public void testInterrupted() throws Exception {
|
||||
taskletStep.setStepExecutionListeners(new StepExecutionListener[] { new InterruptionListener() });
|
||||
taskletStep.execute(stepExecution);
|
||||
assertEquals(FAILED, stepExecution.getStatus());
|
||||
assertEquals(INCOMPLETE, stepExecution.getStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -114,7 +114,7 @@ public class StepExecutorInterruptionTests extends TestCase {
|
||||
|
||||
assertTrue("Timed out waiting for step to be interrupted.", count < 1000);
|
||||
assertFalse(processingThread.isAlive());
|
||||
assertEquals(BatchStatus.FAILED, stepExecution.getStatus());
|
||||
assertEquals(BatchStatus.INCOMPLETE, stepExecution.getStatus());
|
||||
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ public class StepExecutorInterruptionTests extends TestCase {
|
||||
|
||||
assertTrue("Timed out waiting for step to be interrupted.", count < 1000);
|
||||
assertFalse(processingThread.isAlive());
|
||||
assertEquals(BatchStatus.FAILED, stepExecution.getStatus());
|
||||
assertEquals(BatchStatus.INCOMPLETE, stepExecution.getStatus());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -541,7 +541,7 @@ public class TaskletStepTests {
|
||||
stepExecution.setExecutionContext(foobarEc);
|
||||
|
||||
step.execute(stepExecution);
|
||||
assertEquals(BatchStatus.FAILED, stepExecution.getStatus());
|
||||
assertEquals(BatchStatus.INCOMPLETE, stepExecution.getStatus());
|
||||
String msg = stepExecution.getExitStatus().getExitDescription();
|
||||
assertTrue("Message does not contain 'JobInterruptedException': " + msg, contains(msg,
|
||||
"JobInterruptedException"));
|
||||
|
||||
Reference in New Issue
Block a user