Example usage for org.springframework.scheduling.config ScheduledTaskRegistrar addFixedDelayTask

List of usage examples for org.springframework.scheduling.config ScheduledTaskRegistrar addFixedDelayTask

Introduction

In this page you can find the example usage for org.springframework.scheduling.config ScheduledTaskRegistrar addFixedDelayTask.

Prototype

public void addFixedDelayTask(Runnable task, long delay) 

Source Link

Document

Add a Runnable task to be triggered with the given fixed delay.

Usage

From source file:edu.jhuapl.openessence.config.SchedulingConfig.java

@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
    // it would be nice if we could use Spring's @Scheduled annotations,
    // but that doesn't let us inject the trigger rate
    taskRegistrar.addFixedDelayTask(new GraphCleanupTask(), envConfig.graphRetention());
}

From source file:at.porscheinformatik.common.spring.web.extended.config.SpringWebExtendedConfig.java

@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
    StackConfig htmlConfig = configurerConfig.getHtmlConfig();
    final HtmlStacks htmlStacks = htmlStacks();

    if (htmlConfig.getRefreshIntervall() > 0 && htmlStacks != null) {
        taskRegistrar.addFixedDelayTask(new Runnable() {

            @Override/*from   w w  w .  j a  va2  s .  co m*/
            public void run() {
                htmlStacks.refresh();
            }
        }, htmlConfig.getRefreshIntervall() * 1000);
    }

    StackConfig styleConfig = configurerConfig.getStyleConfig();
    final StyleStacks styles = styleStacks();

    if (styleConfig.getRefreshIntervall() > 0 && styles != null) {

        taskRegistrar.addFixedDelayTask(new Runnable() {

            @Override
            public void run() {
                styles.refresh();
            }
        }, styleConfig.getRefreshIntervall() * 1000);
    }

    StackConfig scriptConfig = configurerConfig.getScriptConfig();
    final ScriptStacks scripts = scriptStacks();

    if (scriptConfig.getRefreshIntervall() > 0 && scripts != null) {

        taskRegistrar.addFixedDelayTask(new Runnable() {

            @Override
            public void run() {
                scripts.refresh();
            }
        }, scriptConfig.getRefreshIntervall() * 1000);
    }
}