Announcement Announcement Module
Collapse
No announcement yet.
Stopping a Jobexecution from a different VM/Context Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Stopping a Jobexecution from a different VM/Context

    Hi There,
    I am currently integrating Spring batch into our web application. This would allow users to choose various batch jobs, upload relevant files and start them.

    As per the recommendation in the document for stateful jobs, I have a jobLocator implementation (similar to the samples-JobFactory) where I create an application context for every job execution.

    Now the issue i am facing is - How do I stop a job execution, when I do not have a handle to the JobExecution object, nor the context in which it is running in a different web request-response cycle.
    Since potentially there could be many jobs running simultaneously, How would I be able to get the correct Job Execution -- even if i were to cache all the App-contexts -

    From the sources - it looks like it does not refresh the state of the JobExecution from the Database - so i would not be able to either call the JobExecDaO and get a handle to a JobExecution object (which would be a different object but representing my original execution) - and get the batch to stop

    So given this - My questions -
    1) How do I stop a jobexecution "sometime in the future" from within a webapp - when I have a "context per job execution" strategy
    - the second request may reach a different web application instance too ...

    Cheers
    Murthy
    2)

  • #2
    You would need to retain a reference to the JobExecution that you got when you launched the job. If the GUI you are using is not the same application that launches the job (seems likely) then you have to communicate with that other process somehow, and Spring Batch does not provide a mechanism to do that. How does the job get launched in the first place? Someone has a reference to that JobExecution, so we have to investigate that a bit more before we can discuss a possible implementation.

    What was question 2)?
    Last edited by Dave Syer; May 2nd, 2008, 03:29 AM. Reason: punctuation

    Comment

    Working...
    X