Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent method name [BATCH-2715] #892

Closed
spring-issuemaster opened this issue Apr 24, 2018 · 0 comments
Closed

Inconsistent method name [BATCH-2715] #892

spring-issuemaster opened this issue Apr 24, 2018 · 0 comments

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Apr 24, 2018

Kui Liu opened BATCH-2715 and commented

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;
  }

 


Affects: 4.0.1

Referenced from: pull request https://github.com/spring-projects/spring-batch/pull/600/files

Backported to: 4.1.0.M3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.