/// <summary> /// Deletes a znode /// </summary> public void Delete() { _path = GetPath(_input1); try { IEnumerable <String> children = Zk.GetChildren(_path, false); foreach (var child in children) { Zk.Delete(_path + "/" + child, -1); } Zk.Delete(_path, -1); AppendLineShow(String.Format("Znode {0} was deleted successfully\n", _input1)); } catch (KeeperException.NoNodeException e) { AppendLineShow(String.Format("Znode {0} does not exist!", _input1)); } catch (InvalidOperationException e) { AppendLineShow(string.Format("Znode {0} isn't valid!", _input1)); } catch (Exception e) { AppendLineShow("Exception " + e); } }
public void Delete(string path, int version) { try { Zk.Delete(path, version); } catch (Exception e) { log.Error(String.Format("An error occured while trying to delete. Exception: {0}", e.ToString())); } }
public T Execute <T>(string name, Func <T> func) { WaitforRedial.WaitforRedialFinish(); string id = GetPath(name); try { Zk.Create(id, null, Ids.OPEN_ACL_UNSAFE, CreateMode.Ephemeral); return(func()); } finally { Zk.Delete(id, -1); } }
public void Execute(string name, Action <object> action, object obj) { WaitforRedial.WaitforRedialFinish(); string id = GetPath(name); try { Zk.Create(id, null, Ids.OPEN_ACL_UNSAFE, CreateMode.Ephemeral); action(obj); } finally { Zk.Delete(id, -1); } }