OPEN - BATCH-914: Introduce JobContribution by analogy with StepContribution

wrapped JobExecution status updates in synchronized blocks
This commit is contained in:
robokaso
2008-11-14 12:55:53 +00:00
parent c99fa10f24
commit 9b415455a0
2 changed files with 14 additions and 11 deletions

View File

@@ -37,10 +37,12 @@ public class EndState extends AbstractState {
JobExecution jobExecution = executor.getJobExecution();
// If there are no step executions, then we are at the beginning of a
// restart
if (!jobExecution.getStepExecutions().isEmpty()) {
jobExecution.upgradeStatus(status);
synchronized (jobExecution) {
if (!jobExecution.getStepExecutions().isEmpty()) {
jobExecution.upgradeStatus(status);
}
return FlowExecution.COMPLETED;
}
return FlowExecution.COMPLETED;
}
}

View File

@@ -26,15 +26,16 @@ public class PauseState extends AbstractState {
// This state is just a toggle for the status of the job execution. If
// not already paused we pause it, and expect the flow to respect the
// status.
if (!jobExecution.isPaused()) {
jobExecution.pause();
return FlowExecution.PAUSED;
}
// ...otherwise set the status to show that it has resumed
jobExecution.setStatus(BatchStatus.STARTED);
return FlowExecution.COMPLETED;
synchronized (jobExecution) {
if (!jobExecution.isPaused()) {
jobExecution.pause();
return FlowExecution.PAUSED;
}
// ...otherwise set the status to show that it has resumed
jobExecution.setStatus(BatchStatus.STARTED);
return FlowExecution.COMPLETED;
}
}
}