spring-framework / org.springframework.scheduling.concurrent / ScheduledExecutorTask / setPeriod

setPeriod

open fun setPeriod(period: Long): Unit

Set the period between repeated task executions, in milliseconds.

Default is -1, leading to one-time execution. In case of a positive value, the task will be executed repeatedly, with the given interval inbetween executions.

Note that the semantics of the period value vary between fixed-rate and fixed-delay execution.

Note: A period of 0 (for example as fixed delay) is not supported, simply because java.util.concurrent.ScheduledExecutorService itself does not support it. Hence a value of 0 will be treated as one-time execution; however, that value should never be specified explicitly in the first place!

See Also
#setFixedRate#isOneTimeTask()java.util.concurrent.ScheduledExecutorService#scheduleWithFixedDelay(Runnable, long, long, java.util.concurrent.TimeUnit)