Hi I would like A cronjob to be run within spring but I also need to make sure that they don't overlap when running is this possible. Using spring boot 5.1
@Scheduled(cron="${con}", fixedDelay = 5000)
public void run(){
some method
}
this obviously fails is there some way to obtain this
By default, spring uses a single-threaded Executor. so no two @Scheduled tasks will ever overlap.
您可以检查先前的run方法是否已完成,而不是配置不重叠的cron,如果尚未完成,则退出run()函数。
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.