use of com.netflix.config.WatchedUpdateListener in project archaius by Netflix.
the class ZooKeeperConfigurationSourceTest method setZkProperty.
private static void setZkProperty(String key, String value) throws Exception {
// update the underlying zk property and assert that the new value is picked up
final CountDownLatch updateLatch = new CountDownLatch(1);
zkConfigSource.addUpdateListener(new WatchedUpdateListener() {
public void updateConfiguration(WatchedUpdateResult result) {
updateLatch.countDown();
}
});
zkConfigSource.setZkProperty(key, value);
updateLatch.await();
}
use of com.netflix.config.WatchedUpdateListener in project chassis by Kixeye.
the class DynamicZookeeperConfigurationSource method initializeZookeeperConfigurationSource.
private void initializeZookeeperConfigurationSource() {
if (running) {
LOGGER.warn("Detected creation of node {}, but zookeeper configuration source already running. This should not happen. Ignoring event...", instanceConfigPath);
return;
}
this.zooKeeperConfigurationSource = new ZooKeeperConfigurationSource(curatorFramework, instanceConfigPath);
listeners.forEach(new Function<WatchedUpdateListener, Void>() {
@Nullable
@Override
public Void apply(@Nullable WatchedUpdateListener watchedUpdateListener) {
zooKeeperConfigurationSource.addUpdateListener(watchedUpdateListener);
return null;
}
});
try {
zooKeeperConfigurationSource.start();
} catch (Exception e) {
LOGGER.error("errro starting zookeeper configuration source", e);
throw new BootstrapException("Error initializing zookeeper configuration source", e);
}
running = true;
}
Aggregations