@Override public void awaitUp(long timeout, TimeUnit timeunit) throws TimeoutException { Polling.awaitUnchecked(timeout, timeunit, (Callable<Object>) () -> { try { return curatorWithSuperAuth().usingNamespace(null).getChildren().forPath("/"); } catch (Exception e) { return null; } }); }
@Override public void awaitDown(int timeout, TimeUnit timeunit) throws TimeoutException { Polling.awaitUnchecked(timeout, timeunit, (Callable<Object>) () -> { try { curatorWithSuperAuth().usingNamespace(null).getChildren().forPath("/"); return null; } catch (KeeperException.ConnectionLossException e) { return true; } catch (Exception e) { return null; } }); }
if (CURATOR_TL.get() != null) { zkClient = CURATOR_TL.get().usingNamespace( conf.get(ZK_DTSM_ZNODE_WORKING_PATH, ZK_DTSM_ZNODE_WORKING_PATH_DEAFULT)
CuratorFramework nullNsFw = zkClient.usingNamespace(null); EnsurePath ensureNs = nullNsFw.newNamespaceAwareEnsurePath("/" + zkClient.getNamespace());
public void setClient(CuratorFramework client) { this.client = client.usingNamespace(CloudConfigCommon.PROPERTY_ROOT); }
@Required public void setClient(CuratorFramework client) { this.client = client.usingNamespace(CloudConfigCommon.CONFIG_ROOT); }
@Autowired public void setClient(CuratorFramework client) { this.client = client.usingNamespace(CloudConfigCommon.CONFIG_ROOT); }
@Required public void setClient(CuratorFramework client) { this.client = client.usingNamespace(CloudConfigCommon.CONFIG_ROOT); }
@Override public Object call() throws Exception { try { curator().usingNamespace(null).getChildren().forPath("/"); return null; } catch (KeeperException.ConnectionLossException e) { return true; } catch (Exception e) { return null; } } });
@Override public CuratorFramework usingNamespace(String newNamespace) { return new CellCuratorFramework(inner.usingNamespace(newNamespace), executor); }
@Override public Object call() throws Exception { try { return curator().usingNamespace(null).getChildren().forPath("/"); } catch (Exception e) { return null; } } });
/** * <strong>required</strong><br> * Set the Curator instance to use. In addition * to the Curator instance, specify a namespace for the workflow and a version. The namespace * and version combine to create a unique workflow. All instances using the same namespace and version * are logically part of the same workflow. * * @param curator Curator instance * @param namespace workflow namespace * @param version workflow version * @return this (for chaining) */ public WorkflowManagerBuilder withCurator(CuratorFramework curator, String namespace, String version) { curator = Preconditions.checkNotNull(curator, "curator cannot be null"); namespace = Preconditions.checkNotNull(namespace, "namespace cannot be null"); version = Preconditions.checkNotNull(version, "version cannot be null"); this.curator = curator.usingNamespace(namespace + "-" + version); return this; }
public static CuratorFramework usingChildNamespace(CuratorFramework curator, String... children) { String path = curator.getNamespace(); for (String child : children) { path = path.length() > 0 ? ZKPaths.makePath(path, child) : child; } // Curator does not allow namespaces to start with a leading '/' if (path.startsWith("/")) { path = path.substring(1); } return curator.usingNamespace(path); } }
/** * Creates a new instance of the BookKeeperLogFactory class. * * @param config The configuration to use for all instances created. * @param zkClient ZooKeeper Client to use. * @param executor An executor to use for async operations. */ public BookKeeperLogFactory(BookKeeperConfig config, CuratorFramework zkClient, ScheduledExecutorService executor) { this.config = Preconditions.checkNotNull(config, "config"); this.executor = Preconditions.checkNotNull(executor, "executor"); this.namespace = zkClient.getNamespace(); this.zkClient = Preconditions.checkNotNull(zkClient, "zkClient") .usingNamespace(this.namespace + this.config.getZkMetadataPath()); this.bookKeeper = new AtomicReference<>(); }
ZKPaths.mkdirs(zk, "/"+CloudConfigCommon.PROPERTY_ROOT); CuratorFramework zkConfigClient = zkRootClient.usingNamespace(CloudConfigCommon.CONFIG_ROOT);
if (CURATOR_TL.get() != null) { zkClient = CURATOR_TL.get().usingNamespace( conf.get(ZK_DTSM_ZNODE_WORKING_PATH, ZK_DTSM_ZNODE_WORKING_PATH_DEAFULT)
if (CURATOR_TL.get() != null) { zkClient = CURATOR_TL.get().usingNamespace( conf.get(ZK_DTSM_ZNODE_WORKING_PATH, ZK_DTSM_ZNODE_WORKING_PATH_DEAFULT)
curatorFramework.start(); curatorFramework.blockUntilConnected(); curatorFramework.usingNamespace("fabric"); ObjectMapper objectMapper = new ObjectMapper(); objectMapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
Assert.assertEquals(stat.getNumChildren(), 0); stat = client.usingNamespace(null).checkExists().forPath("/foo/test"); Assert.assertNotNull(stat); Assert.assertEquals(stat.getNumChildren(), 0);
Assert.assertEquals(stat.getNumChildren(), 0); stat = client.usingNamespace(null).checkExists().forPath("/foo/test"); Assert.assertNotNull(stat); Assert.assertEquals(stat.getNumChildren(), 0);