public static Tuple <string, Stat> ReadData(ZkClient client, string path)
        {
            var stat       = new Stat();
            var dataString = client.ReadData <string>(path, stat);

            return(Tuple.Create(dataString, stat));
        }
        public List <Tuple <string, string> > GetZKChildrenValues(string path)
        {
            var children = ZkClient.GetChildren(path).OrderBy(x => x).ToList();

            return
                (children.Select(partition => Tuple.Create(partition, ZkClient.ReadData <string>(path + "/" + partition)))
                 .ToList());
        }
        public static Tuple <string, Stat> ReadDataMaybeNull(ZkClient client, string path)
        {
            var stat = new Stat();

            try
            {
                var obj = client.ReadData <string>(path, stat);
                return(Tuple.Create(obj, stat));
            }
            catch (ZkNoNodeException)
            {
                return(Tuple.Create((string)null, stat));
            }
        }
Exemple #4
0
        public void HandleDataChange(string dataPath, object data)
        {
            Console.WriteLine("run data change HandleDataChange ,path:dataPath");
            this.dataLock.Lock();

            try
            {
                Console.WriteLine("path:" + dataPath + ",data:" + zkClient.ReadData <string>(dataPath));
                this.dataExistsOrChanged.Signal();
            }
            finally
            {
                this.dataLock.Unlock();
            }
        }
Exemple #5
0
 public static Tuple<string, Stat> ReadDataMaybeNull(ZkClient client, string path)
 {
     var stat = new Stat();
     try
     {
         var obj = client.ReadData<string>(path, stat);
         return Tuple.Create(obj, stat);
     }
     catch (ZkNoNodeException)
     {
         return Tuple.Create((string)null, stat);
     }
 }
Exemple #6
0
 public static Tuple<string, Stat> ReadData(ZkClient client, string path)
 {
      var stat = new Stat();
      var dataString = client.ReadData<string>(path, stat);
      return Tuple.Create(dataString, stat);
 }