public class ZooKeeperConfigurationSource
extends java.lang.Object
implements com.netflix.config.WatchedConfigurationSource, java.io.Closeable
WatchedConfigurationSource for ZooKeeper using Curator.
This implementation requires the path to the ZK root parent node that contains
the hierarchy of configuration properties.
An example is /| Constructor and Description |
|---|
ZooKeeperConfigurationSource(org.apache.curator.framework.CuratorFramework client,
java.lang.String configRootPath)
Creates the pathChildrenCache using the CuratorFramework client and ZK root path node for the config
|
| Modifier and Type | Method and Description |
|---|---|
void |
addUpdateListener(com.netflix.config.WatchedUpdateListener l) |
void |
close() |
protected void |
fireEvent(com.netflix.config.WatchedUpdateResult result) |
java.util.Map<java.lang.String,java.lang.Object> |
getCurrentData() |
void |
removeUpdateListener(com.netflix.config.WatchedUpdateListener l) |
void |
start()
Adds a listener to the pathChildrenCache, initializes the cache, then starts the cache-management background thread
|
public ZooKeeperConfigurationSource(org.apache.curator.framework.CuratorFramework client,
java.lang.String configRootPath)
Curator - clientpath - to ZK root parent node for the rest of the configuration properties (ie. /public void start()
throws java.lang.Exception
java.lang.Exceptionpublic java.util.Map<java.lang.String,java.lang.Object> getCurrentData()
throws java.lang.Exception
getCurrentData in interface com.netflix.config.WatchedConfigurationSourcejava.lang.Exceptionpublic void addUpdateListener(com.netflix.config.WatchedUpdateListener l)
addUpdateListener in interface com.netflix.config.WatchedConfigurationSourcepublic void removeUpdateListener(com.netflix.config.WatchedUpdateListener l)
removeUpdateListener in interface com.netflix.config.WatchedConfigurationSourceprotected void fireEvent(com.netflix.config.WatchedUpdateResult result)
public void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseable