I'm using Spring 4.0.5 and Spring Batch 3.0.1
I have a simple step like this, and it works perfectly:
<step id="myStep" next="nextStep">
<tasklet transaction-manager="myTxManager" task-executor="myTaskExecutor" throttle-limit="10">
<batch:chunk reader="myItemReader" processor="myPDFItemProcessor" writer="myItemWriter" commit-interval="20">
</batch:chunk>
</tasklet>
</step>
I have tried a simple skip-limit example (Configuring Skip Logic) like this:
<step id="myStep" next="nextStep">
<tasklet transaction-manager="myTxManager" task-executor="myTaskExecutor" throttle-limit="10">
<batch:chunk reader="myItemReader" processor="myPDFItemProcessor" writer="myItemWriter" commit-interval="20" skip-limit="10000000">
<batch:skippable-exception-classes>
<batch:include class="java.lang.Exception" />
</batch:skippable-exception-classes>
</batch:chunk>
</tasklet>
</step>
When I try to add this logic, this warning is writen in log files:
2015-03-24 16:03:50 [WARN ] [org.springframework.batch.core.step.builder.FaultTolerantStepBuilder.detectStreamInReader(FaultTolerantStepBuilder.java:504)] Asynchronous TaskExecutor detected with ItemStream reader. This is probably an error, and may lead to incorrect restart data being stored.
2015-03-24 16:04:18 [WARN ] [org.springframework.batch.core.step.item.ChunkMonitor.open(ChunkMonitor.java:118)] No ItemReader set (must be concurrent step), so ignoring offset data.
2015-03-24 16:04:18 [WARN ] [org.springframework.batch.core.step.item.ChunkMonitor.getData(ChunkMonitor.java:155)] ItemStream was opened in a different thread. Restart data could be compromised.
The reader is JdbcPagingItemReader with saveState setted to false.
The processor is a CompositeItemProcessor.
The writer is a CompositeItemWriter.
Is there anything wrong with my configuration? Maybe do I need any additional configuration for skip logic to work?
Any help is very appreciated. Thanks
JdbcPagingItemReader
reader, withscope=step
andsaveState=false
. As it does not seem to be thread-safe, I have tested a simple custom ItemReader with asynchronized
read method, which delegates in myItemReader and it hasn't work. So, what can I do to make a thread-safe reader? Or what can I do to make myItemReader a thread-safe one? Thanks a lot. – yaki_nuka