spring Task Execution and Scheduling Fixed delay


Example

If we want some code to be executed periodically after the execution which was before is finished, we should use fixed delay (measured in milliseconds):

@Component
public class MyScheduler{    
    
    @Scheduled(fixedDelay=5000)
    public void doSomething() {
        // this will execute periodically, after the one before finishes
    }
}