Search in sources :

Example 1 with AbstractPollingScheduler

use of com.netflix.config.AbstractPollingScheduler in project ff4j by ff4j.

the class PropertyStoreAsArchaiusInputTest method initArchauisWithFF4j.

@BeforeClass
public static void initArchauisWithFF4j() throws InterruptedException {
    // Sample FF4J Store
    PropertyStore ff4jStore = new InMemoryPropertyStore("ff4j-properties.xml");
    // FF4Store as polling Source for Archiaus
    PolledConfigurationSource ff4jSource = new FF4jPolledConfigurationSource(ff4jStore);
    // Working Thread (polling from ff4j => Archaius)
    AbstractPollingScheduler scheduler = new FixedDelayPollingScheduler(0, 100, true);
    // Define configuration with polling and source
    DynamicConfiguration configuration = new DynamicConfiguration(ff4jSource, scheduler);
    // Init configuration
    ConfigurationManager.install(configuration);
    // Other initialization mechanism
    FF4jPolledConfigurationSource conf2 = new FF4jPolledConfigurationSource();
    conf2.setFf4jStore(ff4jStore);
    // Must invoke poll
    Thread.sleep(100);
}
Also used : InMemoryPropertyStore(org.ff4j.property.store.InMemoryPropertyStore) DynamicConfiguration(com.netflix.config.DynamicConfiguration) AbstractPollingScheduler(com.netflix.config.AbstractPollingScheduler) FixedDelayPollingScheduler(com.netflix.config.FixedDelayPollingScheduler) PolledConfigurationSource(com.netflix.config.PolledConfigurationSource) InMemoryPropertyStore(org.ff4j.property.store.InMemoryPropertyStore) PropertyStore(org.ff4j.property.store.PropertyStore) BeforeClass(org.junit.BeforeClass)

Example 2 with AbstractPollingScheduler

use of com.netflix.config.AbstractPollingScheduler in project ff4j by ff4j.

the class PropertyStoreArchaiusPolledSourceTest method initArchauis.

@BeforeClass
public static void initArchauis() throws InterruptedException {
    // Sample FF4J Store
    PropertyStore ff4jStore = new InMemoryPropertyStore("ff4j-properties.xml");
    // FF4Store as polling Source for Archiaus
    PolledConfigurationSource ff4jSource = new FF4jPolledConfigurationSource(ff4jStore);
    // Working Thread (polling from ff4j => Archaius)
    AbstractPollingScheduler scheduler = new FixedDelayPollingScheduler(0, 1000, true);
    // Define configuration with polling and source
    configuration = new DynamicConfiguration(ff4jSource, scheduler);
}
Also used : InMemoryPropertyStore(org.ff4j.property.store.InMemoryPropertyStore) DynamicConfiguration(com.netflix.config.DynamicConfiguration) AbstractPollingScheduler(com.netflix.config.AbstractPollingScheduler) FixedDelayPollingScheduler(com.netflix.config.FixedDelayPollingScheduler) PolledConfigurationSource(com.netflix.config.PolledConfigurationSource) InMemoryPropertyStore(org.ff4j.property.store.InMemoryPropertyStore) PropertyStore(org.ff4j.property.store.PropertyStore) BeforeClass(org.junit.BeforeClass)

Aggregations

AbstractPollingScheduler (com.netflix.config.AbstractPollingScheduler)2 DynamicConfiguration (com.netflix.config.DynamicConfiguration)2 FixedDelayPollingScheduler (com.netflix.config.FixedDelayPollingScheduler)2 PolledConfigurationSource (com.netflix.config.PolledConfigurationSource)2 InMemoryPropertyStore (org.ff4j.property.store.InMemoryPropertyStore)2 PropertyStore (org.ff4j.property.store.PropertyStore)2 BeforeClass (org.junit.BeforeClass)2