2012-08-07 97 views
1

我有一个非常基本的跳过问题。我使用春季样本提供的spring-batch-simple-cli项目,并试图了解跳过行为。这里有一个非常基本的示例读取器,它从一串字符串中读取数据(我修改了它从10个字符串的列表中读取,从Helloworld 1开始到Hellowworld 10)以及一个记录到控制台的基本作者。编写器在每次写入时抛出java.lang.Exception。 我已经为作业配置添加了4的跳过限制。一旦到达Hellowworld 5,工作就会按预期停止。 但是,每当写入器抛出异常,作者立即被回调与相同的项目。我的问题为什么作家打了两次电话?我期待这个项目被跳过?有什么我失踪了。春季批处理作家,处理器跳过两次调用?

<job id="job1" xmlns="http://www.springframework.org/schema/batch" incrementer="jobParametersIncrementer"> 
    <step id="step1" parent="simpleStep"> 
     <tasklet> 
      <chunk reader="reader" writer="writer" skip-limit="4" > 
       <skippable-exception-classes> 
        <include class="java.lang.Exception" /> 
       </skippable-exception-classes> 
      </chunk> 
     </tasklet> 
    </step> 
</job> 

回答