Announcement Announcement Module
No announcement yet.
Stopping and restarting jobs Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Stopping and restarting jobs

    Hello all,

    i have recently upgraded spring batch from 2.1.9 to 2.2.0. The following batch configuration has a weird behavior.
    If i launch the job for the 1st time flow responds correctly. The problem occurs when i launch this job for 2nd time, it get stuck in an infinite loop while in the background creates in db multiple step executions.
    I can see that the implementation in has changed significantly. Has anyone the same issue? Have i misunderstood the state transition or it is a major defect that can eliminate a connection pool ?

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="" xmlns:xsi=""
        <batch:job id="pattern.replay">
            <batch:step id="pattern.replay.1" next="pattern.replay.2">
                <batch:tasklet allow-start-if-complete="true" transaction-manager="resourcelessTxManager">
                    <bean class="Tasklet1" />
            <batch:step id="pattern.replay.2" next="pattern.replay.3">
                <batch:tasklet allow-start-if-complete="true" transaction-manager="resourcelessTxManager">
                    <bean class="Tasklet2" />
            <batch:step id="pattern.replay.3">
                <batch:tasklet allow-start-if-complete="true" transaction-manager="resourcelessTxManager">
                    <bean class="Tasklet3" />
                <batch:stop on="*" restart="pattern.replay.1" />
                <batch:fail on="FAILED" />

    Last edited by niksik; Jul 18th, 2013, 07:10 PM.

  • #2
    in pattern.replay.3 your saying to stop on * (anything but failed) then restart on pattern.replay.1. all the steps are allow-start-if-complete = true.

    what are you trying to accomplish?


    • #3
      Until version 2.2.0, it was a convenient configuration for preventing concurrent instances of same job, something like singleton running job!
      I m using * because i don't want the job to get completed in any circumstances in order to be able to start it again. Tasklets are totally stateless so it's ok to let them start if complete.
      Despite the fact that there is a workaround, i m wondering why this specific configuration has a totally different behavior in latest version?
      Have you run a simple test case with the above configuration to see yourself what happens?