Examples of EnsurePath


Examples of org.apache.curator.utils.EnsurePath

   *
   * @param client curator client
   * @param path path to create, if needed
   */
  public static void ensurePath(CuratorFramework client, String path) {
    EnsurePath ensurePath = ensurePaths.get(path);
    if (ensurePath == null) {
      ensurePaths.putIfAbsent(path, client.newNamespaceAwareEnsurePath(path));
      ensurePath = ensurePaths.get(path);
    }
    try {
      ensurePath.ensure(client.getZookeeperClient());
    }
    catch (Exception e) {
      throw ZooKeeperUtils.wrapThrowable(e);
    }
  }
View Full Code Here

Examples of org.apache.curator.utils.EnsurePath

    @Test
    public void shouldReadValue() throws Exception {
        // Given
        String propertyValue = "Hello world!";
        CuratorFramework zk = newCurator(hosts);
        new EnsurePath("/foo/bar/baz").ensure(zk.getZookeeperClient());
        zk.setData().forPath("/foo/bar/baz", propertyValue.getBytes());

        // When
        String readPropertyValue = registry.readProperty("foo.bar.baz");
View Full Code Here

Examples of org.apache.curator.utils.EnsurePath

  @Override
  /** {@inheritDoc} */
  public void ensurePath(final String path, final boolean excludingLast) throws KeeperException {
    assertClusterIdFlagTrue();
    EnsurePath ensurePath = client.newNamespaceAwareEnsurePath(path);
    if (excludingLast) {
      ensurePath = ensurePath.excludingLast();
    }
    try {
      ensurePath.ensure(client.getZookeeperClient());
    } catch (Exception e) {
      propagateIfInstanceOf(e, KeeperException.class);
      throw propagate(e);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.