code: private void createParents(String path, List<ACL> acl)
      throws InterruptedException, KeeperException
  
    {
      path = PathUtils.getParentPath(adjustPath(path));
      path = PathUtils.removeTrailingSlash(path);
  
      List<String> paths = new ArrayList<String>();
  
      while(!path.equals("") && getZk().exists(path, false) == null)
      {
        paths.add(path);
  
        path = PathUtils.getParentPath(path);
        path = PathUtils.removeTrailingSlash(path);
      }
  
      Collections.reverse(paths);
  
      for(String p : paths)
      {
        try
        {
          getZk().create(p,
                         null,
                         acl,
                         CreateMode.PERSISTENT);
        }
        catch(KeeperException.NodeExistsException e)
        {
          // ok we continue...
          if(log.isDebugEnabled())
            log.debug("parent already exists " + p);
        }
      }
    }
docs: Implementation note: the method adjusts the path and use getZk() directly because in the
  case where chroot is not null, the chroot path itself may not exist which is why we have to go
  all the way to the root.