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

BatchStatus#isRunning() is not consistent with JobExplorer#findRunningJobExecutions(String) or JobExecution#isRunning() #1483

Closed
spring-projects-issues opened this issue Sep 24, 2013 · 2 comments

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Sep 24, 2013

Alexis SOUMAGNE opened BATCH-2114 and commented

In STOPPING status should be considered as a "running" status.
The endTime is null until job status is STOPPED. Which means that the job did not recieved interuption signal yet.

Simply the code should be :

public boolean isRunning() {
   return this == STARTING || this == STARTED || this == STOPPING;
}

Affects: 2.2.2

@spring-projects-issues
Copy link
Collaborator Author

Alexis SOUMAGNE commented

Up!

@fmbenhassine fmbenhassine removed the status: waiting-for-triage Issues that we did not analyse yet label May 5, 2022
@fmbenhassine fmbenhassine added this to the 5.0.0 milestone May 5, 2022
@fmbenhassine fmbenhassine changed the title BatchStatus#isRunning() is not consistent with JobExplorer#findRunningJobExecutions(String) or JobExecution#isRunning() [BATCH-2114] BatchStatus#isRunning() is not consistent with JobExplorer#findRunningJobExecutions(String) or JobExecution#isRunning() May 5, 2022
@lcmarvin
Copy link
Contributor

lcmarvin commented May 10, 2022

I also encountered a problem related to this issue. That is, when launching multi jobs with same parameters in multi threads, there should be only one job can succeed, but actually, there would be more than one job can succeed.

I find it is caused by SimpleJobRepository#createJobExecution, this method uses JobExecution#isRunning(), but not BatchStatus#isRunning(). So the status STARTING is missing, since startTime of JobExecution will be set only when its status changes to STARTED.

for (JobExecution execution : executions) {
    if (execution.isRunning() || execution.isStopping()) {
        throw new JobExecutionAlreadyRunningException("A job execution for this job is already running: " + jobInstance);
    }
...

lcmarvin added a commit to lcmarvin/spring-batch that referenced this issue May 11, 2022
- A running status is STARTING, STARTED, or STOPPING.
- Make the order when iterating the return value by JdbcJobExecutionDao.findRunningJobExecutions consistent which the result set of the sql.

 Resolves spring-projects#1483
lcmarvin added a commit to lcmarvin/spring-batch that referenced this issue May 12, 2022
- A running status is STARTING, STARTED, or STOPPING.

 Resolves spring-projects#1483
lcmarvin added a commit to lcmarvin/spring-batch that referenced this issue May 13, 2022
- A running status is STARTING, STARTED, or STOPPING.

 Resolves spring-projects#1483
lcmarvin added a commit to lcmarvin/spring-batch that referenced this issue May 13, 2022
- A running status is STARTING, STARTED, or STOPPING.

 Resolves spring-projects#1483
lcmarvin added a commit to lcmarvin/spring-batch that referenced this issue Jul 7, 2022
- A running status is STARTING, STARTED, or STOPPING.
- Update related tests.

 Resolves spring-projects#1483
@fmbenhassine fmbenhassine modified the milestones: 5.0.0, 5.0.0-RC1 Oct 12, 2022
@fmbenhassine fmbenhassine modified the milestones: 5.0.0-RC1, 5.0.0-RC2 Oct 20, 2022
@fmbenhassine fmbenhassine modified the milestones: 5.0.0-RC2, 5.0.0 Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants