List of usage examples for org.springframework.scheduling.config ScheduledTaskRegistrar addFixedDelayTask
public void addFixedDelayTask(IntervalTask task)
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 *//* w ww . j ava2 s. com*/ @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)); }