简体   繁体   中英

Spring Batch Job reader is running continuously although the scheduled time is 5 minutes

I have configured a Spring Batch job with

        triggerBean.setCronExpression(task.getCronExpression());
        triggerBean.setStartTime(task.getStartTime());
        LOG.info("Scheduling task {} to {}", task.getTaskName(), task.getCronExpression());
        scheduler.scheduleJob(jobBean, triggerBean);

Now I have a reader which reads about let say 100 of db rows and then extract the list and give it to writer, now my writer used to process some of the list entries let say 50 of the list provided by reader. The job scheduled for after 10 minutes but I am observing that reader is running continuously infinitely.

Another example: Let say my Reader reads 1 db rows with status column = 1 and count = 4 and give it the writer and I have implemented writer to delete rows entries with column = 1 and count =5 . For this scenario my reader is running continuously and bringing that same data again and again for the writer but the writer cannot process it so this causes infinite loop for the reader. Please suggest what is the problem here and what may be the solution.

Note: Another ticket is raised but i am not sure what may be the issue. Have a look at it.

Spring Batch Job Running in Infinite loop

如果您使用自己的阅读器,则完成从数据库的所有记录的阅读后,需要在阅读器中返回null。请检查自定义阅读器。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM