本文整理汇总了Java中com.netflix.config.FixedDelayPollingScheduler类的典型用法代码示例。如果您正苦于以下问题:Java FixedDelayPollingScheduler类的具体用法?Java FixedDelayPollingScheduler怎么用?Java FixedDelayPollingScheduler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FixedDelayPollingScheduler类属于com.netflix.config包,在下文中一共展示了FixedDelayPollingScheduler类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: locate
import com.netflix.config.FixedDelayPollingScheduler; //导入依赖的package包/类
@Override
public PropertySource<?> locate(Environment environment) {
try {
// configuration from local properties file
ConcurrentMapConfiguration configFromPropertiesFile = new ConcurrentMapConfiguration(new PropertiesConfiguration("application.yml"));
// configuration from system properties
ConcurrentMapConfiguration configFromSystemProperties = new ConcurrentMapConfiguration(new SystemConfiguration());
// configuration from a dynamic source
// PolledConfigurationSource source = new NetflixUrlPolledConfigurationSource();
PolledConfigurationSource source = new NetflixEurekaPolledConfigurationSource();
AbstractPollingScheduler scheduler = new FixedDelayPollingScheduler();
DynamicConfiguration dynamicConfiguration = new DynamicConfiguration(source, scheduler);
// create a hierarchy of configuration that makes
// 1) dynamic configuration source override system properties
// 2) system properties override properties file
ConcurrentCompositeConfiguration finalConfig = new ConcurrentCompositeConfiguration();
finalConfig.addConfiguration(dynamicConfiguration, "dynamicConfig");
finalConfig.addConfiguration(configFromSystemProperties, "systemConfig");
finalConfig.addConfiguration(configFromPropertiesFile, "fileConfig");
// install with ConfigurationManager so that finalConfig
// becomes the source of dynamic properties
ConfigurationManager.install(finalConfig);
} catch(Exception e) {
logger.error(e.getMessage());
}
return null;
}
示例2: translatesKeys
import com.netflix.config.FixedDelayPollingScheduler; //导入依赖的package包/类
@Test
public void translatesKeys() {
String srcKey = FixedDelayPollingScheduler.DELAY_PROPERTY;
String translatedKey = "conqueso.poll.interval";
String value = "15";
Map<String, String> results = getMetadataFromProperties(srcKey, value);
assertTrue(results.containsKey(translatedKey));
assertEquals(value, results.get(translatedKey));
}
开发者ID:rapid7,项目名称:conqueso-client-java,代码行数:12,代码来源:SystemPropertiesInstanceMetadataProviderTest.java
示例3: pollingScheduler
import com.netflix.config.FixedDelayPollingScheduler; //导入依赖的package包/类
@Bean
static AbstractPollingScheduler pollingScheduler(ConfigurableApplicationContext applicationContext) {
int initialDelayMillis = applicationContext.getEnvironment().getProperty(FixedDelayPollingScheduler.INITIAL_DELAY_PROPERTY, Integer.class, 0);
int delayMillis = applicationContext.getEnvironment().getProperty(FixedDelayPollingScheduler.DELAY_PROPERTY, Integer.class, (int) TimeUnit.SECONDS.toMillis(15));
return new FixedDelayPollingScheduler(initialDelayMillis, delayMillis, false);
}