Results 1 to 5 of 5

Thread: Job Share Objects

Hybrid View

  1. #1

    Default Job Share Objects

    How Can I share objects beetwen different jobs ?
    I've one job launched by other jobs with JobLauncher but it only accepts in the run method simple parameters like String,Date, etc..Can I extend JobLauncher ?
    How differents job can comunicate ?
    Can someone help me?

  2. #2
    Join Date
    Dec 2005
    Location
    Lyon, France
    Posts
    311

    Default

    you can use plain Spring beans to share something between jobs (as long as the jobs are running in the same Spring application context.) The Spring beans - some kind of "holders" - would be injected in the artifacts (readers, writer, listeners) of the different jobs. But be careful with that: you're basically coupling the jobs with each other. Don't forget also to clean the holder beans between execution, so that a job doesn't use the data from a previous run.
    Did you also think about storing what you need in the database?

  3. #3

    Default

    Thank you for your answer,
    i'll try to describe my scenario:
    i have a job that loads some data, creates my domain-model object and starts a job. the domain model object has to be shared with the job launched by the first job because the second job requests some resources using a method inside the domain model and start a thread for each resource it obtains. After this (when all the threads ends well) the second job calls a final method inside the domain model object.
    what do you recommend me to do? should i try to use a single job with two steps and one of this steps should be partitionized?

  4. #4

    Default

    Why don't simply make a job with 2 steps?
    having a dedicate child app ctx for each job execution, and have the shared data as one plain spring bean in the job and inject into that 2 step artifacts

  5. #5

    Default

    could you give me an example?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •