当前位置: 首页>>代码示例>>Java>>正文


Java ScheduledTaskRegistrar.setScheduler方法代码示例

本文整理汇总了Java中org.springframework.scheduling.config.ScheduledTaskRegistrar.setScheduler方法的典型用法代码示例。如果您正苦于以下问题:Java ScheduledTaskRegistrar.setScheduler方法的具体用法?Java ScheduledTaskRegistrar.setScheduler怎么用?Java ScheduledTaskRegistrar.setScheduler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.scheduling.config.ScheduledTaskRegistrar的用法示例。


在下文中一共展示了ScheduledTaskRegistrar.setScheduler方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureTasks

import org.springframework.scheduling.config.ScheduledTaskRegistrar; //导入方法依赖的package包/类
@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
    if (properties.isEnabled()) {
        TaskScheduler taskScheduler = null;
        try {
            taskScheduler = this.beanFactory.getBean(TaskScheduler.class);
        } catch (NoUniqueBeanDefinitionException e) {
            taskScheduler = this.beanFactory.getBean("taskScheduler", TaskScheduler.class);
        } catch (NoSuchBeanDefinitionException ex) {
            log.warn("'useExistingScheduler' was configured to 'true', but we did not find any bean.");
        }
        if (taskScheduler != null) {
            log.info("register existing TaskScheduler");
            taskRegistrar.setScheduler(taskScheduler);
        } else {
            throw new BeanCreationException("Expecting a 'ConcurrentTaskScheduler' injected, but was 'null'");
        }
    } else {
        log.info("'CustomSchedulingConfiguration' is disabled, create a default - 'ConcurrentTaskScheduler'");
        this.localExecutor = Executors.newSingleThreadScheduledExecutor();
        taskRegistrar.setScheduler(new ConcurrentTaskScheduler(localExecutor));
    }
}
 
开发者ID:zalando-stups,项目名称:booties,代码行数:24,代码来源:CustomSchedulingConfiguration.java

示例2: configureTasks

import org.springframework.scheduling.config.ScheduledTaskRegistrar; //导入方法依赖的package包/类
@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
    taskRegistrar.setScheduler(taskScheduler());
    taskRegistrar.addTriggerTask(
            new Runnable() {
                public void run() {
                    try {
                        scheduledTasks().calculateWinner();
                    } catch (MessagingException e) {
                        LOGGER.error("Fault while calculating winner!", e);
                    }
                }
            },
            new CronTrigger(winnerCalculationCron)
    );
}
 
开发者ID:jalieven,项目名称:sarcasmotron,代码行数:17,代码来源:Sarcasmotron.java

示例3: configureTasks

import org.springframework.scheduling.config.ScheduledTaskRegistrar; //导入方法依赖的package包/类
@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
	taskRegistrar.setScheduler(taskExecutor());
}
 
开发者ID:esig,项目名称:dss-demonstrations,代码行数:5,代码来源:SchedulingConfig.java

示例4: configureTasks

import org.springframework.scheduling.config.ScheduledTaskRegistrar; //导入方法依赖的package包/类
@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
    taskRegistrar.setScheduler(taskExecutor());
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:5,代码来源:SchedulingConfiguration.java

示例5: configureTasks

import org.springframework.scheduling.config.ScheduledTaskRegistrar; //导入方法依赖的package包/类
@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
	taskRegistrar.setScheduler(taskScheduler());
	taskRegistrar.addFixedRateTask(new IntervalTask(
			new Runnable() {
				@Override
				public void run() {
					worker().executedByThread = Thread.currentThread().getName();
				}
			},
			10, 0));
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:13,代码来源:EnableSchedulingTests.java

示例6: configureTasks

import org.springframework.scheduling.config.ScheduledTaskRegistrar; //导入方法依赖的package包/类
@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
    taskRegistrar.setScheduler(taskScheduler());
}
 
开发者ID:sinsengumi,项目名称:spring-boot-application-infrastructure,代码行数:5,代码来源:Application.java

示例7: configureTasks

import org.springframework.scheduling.config.ScheduledTaskRegistrar; //导入方法依赖的package包/类
@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
    taskRegistrar.setScheduler(Executors.newScheduledThreadPool(1));
}
 
开发者ID:darkfireworld,项目名称:java-fast-framework,代码行数:5,代码来源:SpringConf.java

示例8: configureTasks

import org.springframework.scheduling.config.ScheduledTaskRegistrar; //导入方法依赖的package包/类
@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
	taskRegistrar.setScheduler(taskScheduler());
}
 
开发者ID:aol,项目名称:micro-server,代码行数:5,代码来源:ScheduleAndAsyncConfig.java


注:本文中的org.springframework.scheduling.config.ScheduledTaskRegistrar.setScheduler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。