-
Type:
Improvement
-
Status: Resolved
-
Priority:
Minor
-
Resolution: Complete
-
Affects Version/s: 4.0.1
-
Component/s: Core
-
Labels:None
-
Pull Request URL:
The following method is named as "getStartable". "getStartable" is prone to obtain something. "isStartable" is a query asking whether the stepExecution is startable, which describes what the method is doning. So, "isStartable" should be more intuitive.
protected boolean getStartable(StepExecution stepExecution, ExecutionContext context) throws JobExecutionException { JobInstance jobInstance = stepExecution.getJobExecution().getJobInstance(); String stepName = stepExecution.getStepName(); StepExecution lastStepExecution = jobRepository.getLastStepExecution(jobInstance, stepName); boolean isRestart = (lastStepExecution != null && lastStepExecution.getStatus() != BatchStatus.COMPLETED); if (isRestart) { stepExecution.setExecutionContext(lastStepExecution.getExecutionContext()); } else { stepExecution.setExecutionContext(context); } return shouldStart(allowStartIfComplete, stepExecution, lastStepExecution) || isRestart; }