I guess what you want to say is the scheduleAtFixedRate method
scheduleAtFixedRate(Runnable command,long initialDelay,long period,TimeUnit unit) We can use this method to delay the execution of tasks and set the execution cycle of the task. The time period is calculated from the thread that first starts executing in the thread pool, so assuming that the period is 1s and the thread executes for 5s, the next thread will be executed soon after the first thread finishes running.
scheduleWithFixedDelay(Runnable command,long initialDelay,long delay,TimeUnit unit) This method can be used to delay periodic execution of tasks. delaytime is the delay time between the thread stopping execution and the next start of execution. Assume the following code
I guess what you want to say is the scheduleAtFixedRate method
scheduleAtFixedRate(Runnable command,long initialDelay,long period,TimeUnit unit)
We can use this method to delay the execution of tasks and set the execution cycle of the task. The time period is calculated from the thread that first starts executing in the thread pool, so assuming that the period is 1s and the thread executes for 5s, the next thread will be executed soon after the first thread finishes running.
scheduleWithFixedDelay(Runnable command,long initialDelay,long delay,TimeUnit unit)
This method can be used to delay periodic execution of tasks. delaytime is the delay time between the thread stopping execution and the next start of execution. Assume the following code