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

SimpleJobRepository should ignore non-identifying JobParameters [BATCH-2383] #1221

Open
spring-projects-issues opened this issue May 14, 2015 · 0 comments

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented May 14, 2015

Trevor Baker opened BATCH-2383 and commented

Using the CommandLineJobRunner I pass in some non-identifying parameters but when I rerun with the same parameter, SimpleJobRepository throws an exception:

2015-05-14 12:03:58,414 [ERROR] org.springframework.batch.core.launch.support.CommandLineJobRunner#start:368 | Job Terminated in error: A job instance already exists and is complete for parameters={report.date=1431586800000}.  If you want to run this job again, change the parameters.
org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException: A job instance already exists and is complete for parameters={report.date=1431586800000}.  If you want to run this job again, change the parameters.
        at org.springframework.batch.core.repository.support.SimpleJobRepository.createJobExecution(SimpleJobRepository.java:126)

This is because SimpleJobRepository only checks the number of JobParameters but doesn't check if they are identifying or not.

BatchStatus status = execution.getStatus();
if (execution.getJobParameters().getParameters().size() > 0 && (status == BatchStatus.COMPLETED || status == BatchStatus.ABANDONED)) {
	throw new JobInstanceAlreadyCompleteException(
			"A job instance already exists and is complete for parameters=" + jobParameters
			+ ".  If you want to run this job again, change the parameters.");
}

Related Jira: BATCH-1412


Affects: 3.0.3

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.