/// <summary>
 /// Update the value of a persistent node with the given path and data.
 ///  create parrent directory if necessary. Never throw NodeExistException.
 /// Return the updated path zkVersion
 /// </summary>
 /// <param name="client"></param>
 /// <param name="path"></param>
 /// <param name="data"></param>
 public static void UpdatePersistentPath(ZkClient client, string path, string data)
 {
     try
     {
         client.WriteData(path, data);
     }
     catch (ZkNoNodeException)
     {
         CreateParentPath(client, path);
         try
         {
             client.CreatePersistent(path, data);
         }
         catch (ZkNodeExistsException)
         {
             client.WriteData(path, data);
         }
     }
 }
예제 #2
0
 /// <summary>
 /// Update the value of a persistent node with the given path and data.
 ///  create parrent directory if necessary. Never throw NodeExistException.
 /// Return the updated path zkVersion
 /// </summary>
 /// <param name="client"></param>
 /// <param name="path"></param>
 /// <param name="data"></param>
 public static void UpdatePersistentPath(ZkClient client, string path, string data)
 {
     try
     {
         client.WriteData(path, data);
     }
     catch (ZkNoNodeException)
     {
         CreateParentPath(client, path);
         try
         {
             client.CreatePersistent(path, data);
         }
         catch (ZkNodeExistsException)
         {
             client.WriteData(path, data);
         }
     }
 }