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);
        }
Example #2
0
 public ZooKeeperClient(string configurationName) : this(ZooKeeperConfigSection.FromSection(configurationName))
 {
 }
Example #3
0
        public override ZooKeeperClient CreateNewClient(string key)
        {
            var config = ZooKeeperConfigSection.FromSection(key);

            return(new ZooKeeperClient(config));
        }