Skip to content

Inconsistent method name [BATCH-2715] #892

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

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

Inconsistent method name [BATCH-2715] #892

spring-projects-issues opened this issue Apr 24, 2018 · 0 comments
Labels
has: backports Legacy label from JIRA. Superseded by "for: backport-to-x.x.x" in: core type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

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
Labels
has: backports Legacy label from JIRA. Superseded by "for: backport-to-x.x.x" in: core type: enhancement
Projects
None yet
Development

No branches or pull requests

1 participant