jobTemplate.setTaskExecutor(taskExecutor);
final String threadName = Thread.currentThread().getName();
final Set<String> threadNames = new HashSet<String>();
final RepeatCallback stepCallback = new ItemReaderRepeatCallback<Trade>(provider, processor) {
@Override
public RepeatStatus doInIteration(RepeatContext context) throws Exception {
assertNotSame(threadName, Thread.currentThread().getName());
threadNames.add(Thread.currentThread().getName());
Thread.sleep(100);
TradeItemReader provider = new TradeItemReader(resource);
provider.open(new ExecutionContext());
while (provider.read() != null)
;
return super.doInIteration(context);
}
};
RepeatCallback jobCallback = new RepeatCallback() {
@Override
public RepeatStatus doInIteration(RepeatContext context) throws Exception {
stepTemplate.iterate(stepCallback);
return RepeatStatus.FINISHED;
}