title: Can't stop spring batch step
body: <p>Can`t stop spring batch step..</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;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/batch http://www.springframework.org/schema/batch/spring-batch-2.1.xsd
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"&gt;
  
      &lt;description&gt;Example job to get you started. It provides a skeleton for a typical batch application.&lt;/description&gt;
  &lt;bean id="HelloTasklet" class="c.c.c.HelloTasklet" scope="step"/&gt;
  &lt;bean id="completionPolicy" class="org.springframework.batch.repeat.policy.DefaultResultCompletionPolicy"/&gt; 
  &lt;bean id="chunkTimeout" class="org.springframework.batch.repeat.policy.TimeoutTerminationPolicy"&gt;
      &lt;constructor-arg value="3"/&gt;
  &lt;/bean&gt;
  &lt;bean id="commitCount" class="org.springframework.batch.repeat.policy.SimpleCompletionPolicy"&gt;
      &lt;property name="chunkSize" value="200" /&gt;
  &lt;/bean&gt;
  &lt;bean id="chunkCompletionPolicy" class="org.springframework.batch.repeat.policy.CompositeCompletionPolicy"&gt;
      &lt;property name="policies"&gt;
      &lt;list&gt;
          &lt;ref bean="chunkTimeout" /&gt;
          &lt;ref bean="commitCount" /&gt;
      &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  &lt;bean id="RandomChunkSizePolicy" class="c.c.c.RandomChunkSizePolicy"/&gt;
  &lt;job id="importInvoices"  xmlns="http://www.springframework.org/schema/batch"&gt;  
  &lt;listeners&gt;
  &lt;listener ref="loggingListener"/&gt;
  &lt;/listeners&gt;
      &lt;step id="vehicleStep" next="hello"&gt;
      &lt;tasklet&gt;
          &lt;chunk reader="vehicleReader"  writer="vehicleWriter" chunk-completion-policy="RandomChunkSizePolicy"/&gt;
      &lt;/tasklet&gt;
  &lt;/step&gt;
      &lt;step id="hello" next="decompress"&gt;
          &lt;tasklet ref="HelloTasklet" /&gt;
      &lt;/step&gt;
  
      &lt;step id="decompress" next="readWriteInvoices"&gt;
          &lt;tasklet ref="decompressTasklet" /&gt;
      &lt;/step&gt;
      &lt;step id="readWriteInvoices"&gt;
          &lt;tasklet&gt;
              &lt;chunk reader="reader" writer="writer" commit-interval="100" /&gt;
          &lt;/tasklet&gt;  
      &lt;/step&gt;
  &lt;/job&gt;
   &lt;bean id="loggingListener" class="c.c.c.JobLoggerListener"&gt;&lt;/bean&gt;
  &lt;bean id="decompressTasklet" class="c.c.c.DecompressTasklet"&gt;
      &lt;property name="inputResource" value="file:./input/input.zip" /&gt; 
      &lt;property name="targetDirectory" value="./work/output/" /&gt; 
      &lt;property name="targetFile" value="invoices.txt" /&gt; 
  &lt;/bean&gt;
  &lt;bean id="reader" class="org.springframework.batch.item.file.FlatFileItemReader"&gt;
      &lt;property name="resource" value="file:./work/output/invoices.txt" /&gt;
      &lt;property name="linesToSkip" value="1" /&gt;
      &lt;property name="lineMapper"&gt;
          &lt;bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper"&gt;
              &lt;property name="lineTokenizer"&gt;
                  &lt;bean class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer"&gt;
                      &lt;property name="names" value="INVOICE_ID,CUSTOMER_ID,DESCRIPTION,ISSUE_DATE,AMOUNT" /&gt;
                  &lt;/bean&gt;
              &lt;/property&gt;
              &lt;property name="fieldSetMapper"&gt;
                  &lt;bean class="c.c.c.InvoiceFieldSetMapper" /&gt; 
              &lt;/property&gt;
          &lt;/bean&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  &lt;bean id="writer" class="c.c.c.InvoiceJdbcItemWriter"&gt;
      &lt;constructor-arg ref="dataSource" /&gt;
  &lt;/bean&gt; 
  &lt;/beans&gt;
  </code></pre>
  
  <p>and see this in input:</p>
  
  <pre><code>The chunk size has been set to 2
  Reader
  Reader
  Writer
  [reeeeader, reeeeader]
  
  The chunk size has been set to 2
  Reader
  Reader
  Writer
  [reeeeader, reeeeader]
  
  The chunk size has been set to 2
  Reader
  Reader
  Writer
  [reeeeader, reeeeader]
  </code></pre>
  
  <p>..and so on. Need advice.</p>