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

Obvious JobLocator implementation [BATCH-942] #2608

Closed
spring-issuemaster opened this issue Nov 25, 2008 · 6 comments
Closed

Obvious JobLocator implementation [BATCH-942] #2608

spring-issuemaster opened this issue Nov 25, 2008 · 6 comments

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Nov 25, 2008

David J. M. Karlsen opened BATCH-942 and commented

It's handy to be able to reference jobs with name rather than instance - which the locator does.
So a Locator which looks up a job from the app ctx seems obvious.
The attached class does this.


Affects: 1.1.3

Attachments:

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Nov 28, 2008

Dave Syer commented

What's the use case for this? It doesn't help much in 1.x when launching a job repeatedly from the same process because there are usually too many stateful objects inside the Job - it is better to create a new ApplicationContext (as per docos) for each execution. In 2.0 the stateful problem can be solved with scope="step" and you can then just inject the job into whatever needs it.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Nov 28, 2008

David J. M. Karlsen commented

Stateful is avoided by using org.springframework.batch.core.resource.StepExecutionResourceProxy - as well as passing parameters through the JobParameters.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Nov 29, 2008

Dave Syer commented

Those are nice features but don't change the fact that the readers and writers you are using are stateful. I couldn't recommend a multi-threaded system launching multiple jobs using those as the only safeguards, or with this JobLocator proposal. I can't see the need for a JobLocator unless you are planning to potentially launch multiple instances of the same job. The only way it can work safely is if they don't get launched concurrently. Is it still useful if you take that into account?

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Nov 30, 2008

David J. M. Karlsen commented

They run sequentially (sorted order) - I'll go for a ClassPathXmlApplicationContextJobFactory instead - some of the other objects used in the jobs also have state (HibernateAwareItemWriter).

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Feb 22, 2009

Dave Syer commented

ClassPathXmlApplicationContextJobFactory was added in 2.0 (M3?).

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Feb 22, 2009

David J. M. Karlsen commented

It's in 1.1.3 and 1.1.4 as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.