code: public void createPersistent(String path, Object data, boolean createParents) throws ZkInterruptedException,
                                                                                   IllegalArgumentException, ZkException,
                                                                                   RuntimeException {
          try {
              create(path, data, CreateMode.PERSISTENT);
          } catch (ZkNodeExistsException e) {
              if (!createParents) {
                  throw e;
              }
          } catch (ZkNoNodeException e) {
              if (!createParents) {
                  throw e;
              }
              String parentDir = path.substring(0, path.lastIndexOf('/'));
              createPersistent(parentDir, createParents);
              createPersistent(path, data, createParents);
          }
      }
docs: Create a persistent Sequential node.
  
  @param path
  @param data
  @param createParents if true all parent dirs are created as well and no {@link ZkNodeExistsException} is thrown
  in case the path already exists
  @throws ZkInterruptedException if operation was interrupted, or a required reconnection got interrupted
  @throws IllegalArgumentException if called from anything except the ZooKeeper event thread
  @throws ZkException if any ZooKeeper exception occurred
  @throws RuntimeException if any other exception occurs