Exemple #1
0
        internal static void UpdatePersistentPath(IZooKeeperClient zkClient, string path, string data)
        {
            try
            {
                zkClient.WriteData(path, data);
            }
            catch (KeeperException e)
            {
                if (e.ErrorCode == KeeperException.Code.NONODE)
                {
                    CreateParentPath(zkClient, path);

                    try
                    {
                        zkClient.CreatePersistent(path, data);
                    }
                    catch (KeeperException e2)
                    {
                        if (e2.ErrorCode == KeeperException.Code.NODEEXISTS)
                        {
                            zkClient.WriteData(path, data);
                        }
                        else
                        {
                            throw;
                        }
                    }
                }
                else
                {
                    throw;
                }
            }
        }
Exemple #2
0
        internal static void CreateParentPath(IZooKeeperClient zkClient, string path)
        {
            var parentDir = path.Substring(0, path.LastIndexOf('/'));

            if (parentDir.Length != 0)
            {
                zkClient.CreatePersistent(parentDir, true);
            }
        }
Exemple #3
0
        internal static void UpdatePersistentPath(IZooKeeperClient zkClient, string path, string data)
        {
            try
            {
                zkClient.WriteData(path, data);
            }
            catch (KeeperException.NoNodeException)
            {
                CreateParentPath(zkClient, path);

                try
                {
                    zkClient.CreatePersistent(path, data);
                }
                catch (KeeperException.NodeExistsException)
                {
                    zkClient.WriteData(path, data);
                }
            }
        }
Exemple #4
0
 internal static void CreateParentPath(IZooKeeperClient zkClient, string path)
 {
     string parentDir = path.Substring(0, path.LastIndexOf('/'));
     if (parentDir.Length != 0)
     {
         zkClient.CreatePersistent(parentDir, true);
     }
 }
Exemple #5
0
        internal static void UpdatePersistentPath(IZooKeeperClient zkClient, string path, string data)
        {
            try
            {
                zkClient.WriteData(path, data);
            }
            catch (KeeperException.NoNodeException)
            {
                CreateParentPath(zkClient, path);

                try
                {
                    zkClient.CreatePersistent(path, data);
                }
                catch (KeeperException.NodeExistsException)
                {
                    zkClient.WriteData(path, data);
                }
            }
        }
        internal static void UpdatePersistentPath(IZooKeeperClient zkClient, string path, string data)
        {
            try
            {
                zkClient.WriteData(path, data);
            }
            catch (KeeperException e)
            {
                if (e.ErrorCode == KeeperException.Code.NONODE)
                {
                    CreateParentPath(zkClient, path);

                    try
                    {
                        zkClient.CreatePersistent(path, data);
                    }
                    catch (KeeperException e2)
                    {
                        if (e2.ErrorCode == KeeperException.Code.NODEEXISTS)
                            zkClient.WriteData(path, data);
                        else
                            throw;
                    }
                }
                else
                    throw;
            }
        }