Skip to content

Inconsistent method name [BATCH-2715] #892

@spring-projects-issues

Description

@spring-projects-issues

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions