【发布时间】:2012-07-12 09:14:30
【问题描述】:
我在执行 spring 批处理时面临一个奇怪的情况。我已将作业步骤执行配置为使用“skippable-exception-classes”作为
<step id="prepareFileStep" next="fillRecordsCounterStep">
<tasklet>
<chunk reader="stagingIdReader" writer="customerIdRecordCompWriter" commit-interval="50" skip-limit="200">
<streams>
<stream ref="flatFileRecordWriter" />
</streams>
<skippable-exception-classes>
<include class="java.lang.Exception" />
</skippable-exception-classes>
</chunk>
<listeners>
<listener ref="prepareFlatFileSkipListener" />
<listener ref="prepareFlatFileStepListener" />
</listeners>
</tasklet>
而我的 onSkipInWrite() 实现为:
@OnSkipInWrite
public void onSkipInWrite(Object item, Throwable exception) {
AppLog.warn(AppConstants.CALLER, "Skipping Customer Id:"+ item.getCustomer().getCustomerId()+"\n" + exception.toString());
}
我想知道为什么日志文件会打印两次跳过的项目,而当我调试时它只执行一次?请给我建议修复的朋友...
【问题讨论】:
标签: spring-batch