本文整理汇总了Java中org.springframework.scheduling.config.ScheduledTaskRegistrar.addFixedDelayTask方法的典型用法代码示例。如果您正苦于以下问题:Java ScheduledTaskRegistrar.addFixedDelayTask方法的具体用法?Java ScheduledTaskRegistrar.addFixedDelayTask怎么用?Java ScheduledTaskRegistrar.addFixedDelayTask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.scheduling.config.ScheduledTaskRegistrar
的用法示例。
在下文中一共展示了ScheduledTaskRegistrar.addFixedDelayTask方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureTasks
import org.springframework.scheduling.config.ScheduledTaskRegistrar; //导入方法依赖的package包/类
/**
* Configures the scheduler by registering task responsible for periodically refreshing entire endpoint.
*
* @param taskRegistrar the task registrar
*/
@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));
}
开发者ID:jmnarloch,项目名称:spring-cloud-config-refresh,代码行数:20,代码来源:ConfigClientRefreshAutoConfiguration.java
示例2: configureTasks
import org.springframework.scheduling.config.ScheduledTaskRegistrar; //导入方法依赖的package包/类
@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar)
{
StackConfig htmlConfig = configurerConfig.getHtmlConfig();
final HtmlStacks htmlStacks = htmlStacks();
if (htmlConfig.getRefreshIntervall() > 0 && htmlStacks != null)
{
taskRegistrar.addFixedDelayTask(() -> htmlStacks.refresh(), htmlConfig.getRefreshIntervall() * 1000);
}
StackConfig styleConfig = configurerConfig.getStyleConfig();
final StyleStacks styles = styleStacks();
if (styleConfig.getRefreshIntervall() > 0 && styles != null)
{
taskRegistrar.addFixedDelayTask(() -> styles.refresh(), styleConfig.getRefreshIntervall() * 1000);
}
StackConfig scriptConfig = configurerConfig.getScriptConfig();
final ScriptStacks scripts = scriptStacks();
if (scriptConfig.getRefreshIntervall() > 0 && scripts != null)
{
taskRegistrar.addFixedDelayTask(() -> scripts.refresh(), scriptConfig.getRefreshIntervall() * 1000);
}
}
示例3: configureTasks
import org.springframework.scheduling.config.ScheduledTaskRegistrar; //导入方法依赖的package包/类
@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar)
{
long interval = configurerConfiguration.getStaticFolderRegistry().getResourceRefreshInterval();
if (interval > 0)
{
taskRegistrar.addFixedDelayTask(() -> staticFolderCache.refreshFolders(), interval * 1000);
}
}