Scheduling Task in Spring/Java

前端 未结 5 1587
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-05 13:07

I am spawning a thread which will keep pulling the chunk of records from database and putting them into the queue. This thread will be started on the server load. I want thi

5条回答
  •  遥遥无期
    2021-01-05 13:28

    You can try using Quartz scheduler. http://quartz-scheduler.org/ That will allow you to specify the duration of time between task executions. You can set a flag (boolean) that says if the class has run before to avoid duplicating code that you only want to run the 'first' time.

提交回复
热议问题