You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provide method for stopping Batch 5 Jobs upon user request
In the previous release of SCDF we used the JsrJobOperator to stop job executions.
The 2 stages of stopping jobs is as follows:
1) Sets the Batch Status of the job execution to STOPPING. This signals to Spring Batch to stop execution at the next step.
2) If the Job is a StepLocator it will go through each of the StoppableTasklets and stop them.
So when using Batch 4.x it was just a quick check of the JobRegistry to retrieve the job, which was always empty since SCDF never deals with Jobs directly.
But with Batch 5.x they loaded the Job Registry and attempted to retrieve the Job in a different way using the SimpleJobOperator.
In the updated solution, SCDF doesn't use the SimpleJobOperator since SCDF doesn't have access to the StepLocator for the Job, nor does it use the JobRegistry and even if it did, it would always be empty.
w
* Modify stopAll so that it calls stop() instead of using its own logic
* Add Test for stopAll
Updated based on code review
Extract job stop code from stop(long) and place into stopJobExecution method.
The stopJobExecution method will be used by stop(long) and stopAll.
Updated Based on Code Review
Moved Job Stop Code from assert methods to the tests.
Updated the JobExecution Create methods so that they verify that the job is not Stopping
Copy file name to clipboardExpand all lines: spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/batch/SimpleJobService.java
+11-8Lines changed: 11 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -225,9 +225,7 @@ public int stopAll() {
225
225
Collection<JobExecution> result = jobExecutionDao.getRunningJobExecutions();
Copy file name to clipboardExpand all lines: spring-cloud-dataflow-server-core/src/test/java/org/springframework/cloud/dataflow/server/batch/AbstractSimpleJobServiceTests.java
0 commit comments