public void clean(String path) throws InterruptedException, KeeperException {
    List<String> children;
    try {
      children = getChildren(path, null, true);
    } catch (NoNodeException r) {
      return;
    }
    for (String string : children) {
      // we can't clean the built-in zookeeper node
      if (path.equals("/") && string.equals("zookeeper")) continue;
      if (path.equals("/")) {
        clean(path + string);
      } else {
        clean(path + "/" + string);
      }
    }
    try {
      if (!path.equals("/")) {
        delete(path, -1, true);
      }
    } catch (NoNodeException r) {
      return;
    }
  }