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

Spring batch doesn't support multiple job repositories (or 1 repository with shifting data source) in the same JVM [BATCH-2476] #1126

Closed
spring-projects-issues opened this issue Feb 22, 2016 · 1 comment
Labels
in: core status: invalid Legacy label from JIRA. Superseded by "status: declined" type: bug

Comments

@spring-projects-issues
Copy link
Collaborator

Gustavo Lopes opened BATCH-2476 and commented

The static StepSynchronizationManager.manager keeps state in such a way that it becomes impossible to run at the same time two steps belonging to different jobs but where:

a) the jobs have the same id,
b) the steps have the same name and
c) the steps have the same id.

This situation may arise if more than one repository is in use (or there is one repository, but it uses different data sources at the same time).

See the linked StackOverflow thread for more details. The problem can be reproduced with https://gist.github.com/cataphract/6b0619a2e28ec3b36739


Affects: 3.0.6

Reference URL: http://stackoverflow.com/a/35544379/127724

@fmbenhassine
Copy link
Contributor

Spring batch doesn't support multiple job repositories (or 1 repository with shifting data source) in the same JVM

With Spring Batch, you define a job and tell it which job repository it should use to report its meta-data. So what does "support multiple job repositories" specifically mean related to this? Nothing prevents you from creating multiple JobRepository beans in the same (or different) application context(s) running in the same JVM. Telling each job which job repository it should use for reporting is a matter of configuration.

And what do you mean by "1 repository with shifting data source"?

different jobs but where: a) the jobs have the same id

How could two different jobs have the same id?

This situation may arise if more than one repository is in use

The idea of using a central shared job repository is to prevent creating duplicate jobs in a clustered environment. Using two or more repositories goes against this initial goal.

(or there is one repository, but it uses different data sources at the same time).

How is this even possible?

I'm closing this issue for now because the problem is not clear to me (even after reading the gist and the SO thread). Please elaborate by providing more details and a valid use case and we can discuss further.

@fmbenhassine fmbenhassine removed the status: waiting-for-triage Issues that we did not analyse yet label Feb 5, 2020
@fmbenhassine fmbenhassine added the status: invalid Legacy label from JIRA. Superseded by "status: declined" label Jan 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core status: invalid Legacy label from JIRA. Superseded by "status: declined" type: bug
Projects
None yet
Development

No branches or pull requests

2 participants