for example, the fixedRate of a scheduled task is 5 seconds, but sometimes the task executes for more than 5 seconds. What about the next execution of the task?
or cron starts to do a task in 5 seconds per minute, but if the task takes more than 1 minute, what about the next execution of the task?
< H2 > suppose that if there is a timed thread pool, will another thread be taken from the thread pool to perform the next execution of the task, so that the two execution of the task can be carried out concurrently? < / H2 >in fact, from another point of view, we know that there are two ways to start two tasks An and B. one is to put them in the same class
. @Component
Class Tasks{
@Scheduled(cron="5 */1 * * * ?")
public void ATask(){
...
}
@Scheduled(cron="5 */1 * * * ?")
public void BTask(){
...
}
}
one is put in two different classes
@Component
Class ATask{
@Scheduled(cron="5 */1 * * * ?")
public void Task(){
...
}
}
@Component
Class BTask{
@Scheduled(cron="5 */1 * * * ?")
public void Task(){
...
}
}
if there is a timed thread pool, then both An and B tasks can be performed concurrently, right? But if the two executions of the same task overlap in time, can they be executed in parallel?