Announcement Announcement Module
Collapse
No announcement yet.
Stopping and restarting jobs Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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 SimpleFlow.java 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 ?

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:batch="http://www.springframework.org/schema/batch"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-3.2.xsd
            http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.2.xsd">
    
        <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:tasklet>
            </batch:step>
            <batch:step id="pattern.replay.2" next="pattern.replay.3">
                <batch:tasklet allow-start-if-complete="true" transaction-manager="resourcelessTxManager">
                    <bean class="Tasklet2" />
                </batch:tasklet>
            </batch:step>
            <batch:step id="pattern.replay.3">
                <batch:tasklet allow-start-if-complete="true" transaction-manager="resourcelessTxManager">
                    <bean class="Tasklet3" />
                </batch:tasklet>
                <batch:stop on="*" restart="pattern.replay.1" />
                <batch:fail on="FAILED" />
            </batch:step>
        </batch:job>
    </beans>
    Thanks,

    NS
    Last edited by niksik; Jul 18th, 2013, 08: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?

    Comment


    • #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?

      Comment

      Working...
      X