public ZooKeeperConfigProvider(string configurationName, string path) { //load data from zk using (var client = new ZooKeeperClient(configurationName)) { var json = client.Get <string>(path); //parse json and assign data } }
public ZooKeeperDistributedLock(string key, string configName) { var config = ZooKeeperConfigSection.FromSection(configName); _client = new ZooKeeperClient(config); _path = config.DistributedLockPath + "/" + key.ToMD5(); //抢锁 new Action(() => { _client.CreatePersistentPath(_path); _no = _client.CreateSequential(_path + "/", false); }).InvokeWithRetry(5); }