Questions related to springboot Scheduled ~

now there is a scheduled task in the project, which is executed in the early hours of every day, but one day the amount of data is so large that the task has not been finished for one day, and has been executed until the next day, and then the task begins to be executed again. So it causes data duplication

related codes

    /***
     * sqlserver
     * @throws Exception 
     */
    @Scheduled(cron = "0 0 1 * * ?")
    public void switchDate(){}

it says so, now I want to see if the same task is finished at the same time when the task is executed, and postpone the task execution time if it is not finished. I checked that the concurrent attribute of Quartz is similar to that of . It goes like this:

where the concurrent attribute identification is interpreted as: for the same JobDetail , when you specify multiple Trigger , it is likely that the second job starts before the first job is completed. Specify concurrent to false , multiple job will not run concurrently, and the second job will not start before the first job is completed.

so is the second job at this point delayed or cancelled? Today, I did a small experiment with this question as follows: set the Trigger of the task to be executed every 10 seconds, and then let Thread pause 15 seconds inside the executing task, so that there must be time overlap between different job . After starting the program, it is found that the number of seconds at the end of the previous job execution is 15 , and the second job , which was originally executed in 10s , starts immediately.

thus, the concurrent attribute actually delays the execution of job.

does anyone know? I can"t express myself clearly. I"m sorry. ("") y


spring defaults to single-threaded executor,. This should not happen when the first executes the second before the execution is finished. Or you can integrate quartz: https://docs.spring.io/spring.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b34d28-2ac8b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b34d28-2ac8b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?