title: Job in spring batch is getting executed multiple times and not stopping
body: <p>I am trying to read data from cassandra using spring batch, where I have implemented ItemReader, ItemProcessor, and ItemWriter. I am able to read the data , process it and write back the data to the same table. I am creating xml file to execute the job:</p>
  
  <p>xml:</p>
  
  <pre><code>    &lt;job id="LoadStatusIndicator" job-repository="jobRepository" restartable="false"&gt;
          &lt;step id="LoadStatus" next=""&gt;
              &lt;tasklet&gt;
                  &lt;chunk reader="StatusReader" processor="ItemProcessor" writer="ItemWriter"
                      commit-interval="10" /&gt;
              &lt;/tasklet&gt;
          &lt;/step&gt;
      &lt;/job&gt;
  
      &lt;beans:bean id="ItemWriter" scope="step"
          class="com.batch.writer.ItemWriter"&gt;
      &lt;/beans:bean&gt;
  
  &lt;beans:bean id="ItemProcessor" scope="step"
          class="com.batch.processor.ItemProcessor"&gt;
      &lt;/beans:bean&gt;
      &lt;beans:bean id="Reader" scope="step"
          class="com.reader.ItemReader"&gt;
          &lt;beans:property name="dataSource" ref="CassandraSource" /&gt;
  
      &lt;/beans:bean&gt;
  </code></pre>
  
  <p>applicationcontext.xml:</p>
  
  <pre><code>&lt;beans:bean id="CassandraSource" parent="DataSourceParent"&gt;
  &lt;beans:property name="url" value="jdbc:cassandra://${cassandra.hostName}:${cassandra.port}/${cassandra.keyspace}" /&gt;
  &lt;beans:property name="driverClassName" value="org.apache.cassandra.cql.jdbc.CassandraDriver" /&gt;
  &lt;/beans:bean&gt;
  </code></pre>
  
  <p>reader class:</p>
  
  <pre><code>   public static final String query = "SELECT * FROM test_1 allow filtering;";
  
   @Override
      public List&lt;Item&gt; read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException 
      {
      List&lt;Item&gt; results = new ArrayList&lt;Item&gt;();
  try {
  results = cassandraTemplate.select(query,Item.class);
      } catch (Exception e) {
      e.printStackTrace();
      }
  return results;
      }
  </code></pre>
  
  <p>writer classs:</p>
  
  <pre><code>@Override
  public void write(List&lt;? extends Item&gt; item) throws Exception {
      try {
      cassandraTemplate.insert(item);
  }catch(Exception e){e.printStackTrace();}
  </code></pre>
  
  <p>But the problem is the whole job is getting executed multiple times , infact it is not stopping at all. I have to force stop the job execution. I have only 2 rows in the table.
  I think it is because of the commit-interval defined in xml, but having commit-interval = 10, job executes more than 10 times</p>
  
  <p>According to my understanding, when I run the xml file that means I am running the job only one time, it calls the reader once keeps the data in the run time memory (job repository), calls item processor once (I use list ) and the whole list is inserted at once</p>