OPEN - BATCH-914: Introduce JobContribution by analogy with StepContribution
wrapped JobExecution status updates in synchronized blocks
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user