List of usage examples for org.springframework.scheduling.config IntervalTask IntervalTask
public IntervalTask(Runnable runnable, long interval, long initialDelay)
From source file:com.github.jmnarloch.spring.cloud.config.refresh.ConfigClientRefreshAutoConfiguration.java
/** * Configures the scheduler by registering task responsible for periodically refreshing entire endpoint. * * @param taskRegistrar the task registrar *//*ww w .j a v a2s . c om*/ @Override public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { final long interval = getRefreshIntervalInMilliseconds(); logger.info(String.format("Scheduling config refresh task with %s second delay", refreshInterval)); taskRegistrar.addFixedDelayTask(new IntervalTask(new Runnable() { @Override public void run() { refreshEndpoint.refresh(); } }, interval, interval)); }