gpt4 book ai didi

com.spotify.helios.servicescommon.coordination.ZooKeeperClient.create()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 03:37:31 27 4
gpt4 key购买 nike

本文整理了Java中com.spotify.helios.servicescommon.coordination.ZooKeeperClient.create()方法的一些代码示例,展示了ZooKeeperClient.create()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperClient.create()方法的具体详情如下:
包路径:com.spotify.helios.servicescommon.coordination.ZooKeeperClient
类名称:ZooKeeperClient
方法名:create

ZooKeeperClient.create介绍

暂无

代码示例

代码示例来源:origin: spotify/helios

@Override
public void create(String path) throws KeeperException {
 reporter.time(tag, "create", () -> {
  client.create(path);
  return null;
 });
}

代码示例来源:origin: spotify/helios

@Test
public void testZooKeeperClient() throws Exception {
 // Create the cluster ID node
 zk().curatorWithSuperAuth().newNamespaceAwareEnsurePath(Paths.configId(zkClusterId))
   .ensure(zk().curatorWithSuperAuth().getZookeeperClient());
 // We need to create a new curator because ZooKeeperClient will try to start it,
 // and zk().curator() has already been started.
 final ExponentialBackoffRetry retryPolicy = new ExponentialBackoffRetry(1000, 3);
 final CuratorFramework curator = CuratorFrameworkFactory.builder()
   .retryPolicy(retryPolicy)
   .connectString(zk().connectString())
   .build();
 final ZooKeeperClient client = new DefaultZooKeeperClient(curator, zkClusterId);
 client.start();
 // This should work since the cluster ID exists
 client.create("/test");
 // Now let's remove the cluster ID
 client.delete(Paths.configId(zkClusterId));
 // Sleep so the watcher thread in ZooKeeperClient has a chance to update state
 Thread.sleep(500);
 // Try the same operation again, and it should fail this time
 try {
  client.ensurePath(Paths.configJobs());
  fail("ZooKeeper operation should have failed because cluster ID was removed");
 } catch (IllegalStateException ignore) {
  // ignored
 }
}

代码示例来源:origin: at.molindo/helios-services

@Override
public void create(String path) throws KeeperException {
 try {
  client.create(path);
 } catch (KeeperException e) {
  reporter.checkException(e, tag, "create");
  throw e;
 }
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com