gpt4 book ai didi

com.bazaarvoice.curator.dropwizard.ZooKeeperConfiguration.newCurator()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 03:35:31 28 4
gpt4 key购买 nike

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

ZooKeeperConfiguration.newCurator介绍

[英]Return a new Curator connection to the ensemble. It is the caller's responsibility to start and close the connection.
[中]将一个新的策展人连接返回集合。呼叫方负责启动和关闭连接。

代码示例

代码示例来源:origin: com.bazaarvoice.curator/dropwizard

/**
 * Return a managed Curator connection.  This created connection will be wrapped in a
 * {@link ManagedCuratorFramework} and offered to the provided {@link LifecycleEnvironment} parameter.
 */
public CuratorFramework newManagedCurator(LifecycleEnvironment env) {
  CuratorFramework curator = newCurator();
  env.manage(new ManagedCuratorFramework(curator));
  return curator;
}

代码示例来源:origin: bazaarvoice/emodb

@Override
  protected void run(Bootstrap<EmoConfiguration> bootstrap, Namespace namespace, EmoConfiguration configuration)
      throws Exception {
    String serviceName = namespace.getString("service");

    CuratorFramework curator = configuration.getZooKeeperConfiguration().newCurator();
    curator.start();

    ZooKeeperHostDiscovery hostDiscovery = new ZooKeeperHostDiscovery(curator, serviceName, bootstrap.getMetricRegistry());

    for (ServiceEndPoint endPoint : hostDiscovery.getHosts()) {
      System.out.println(endPoint.getId());
    }

    hostDiscovery.close();
    curator.close();
  }
}

代码示例来源:origin: bazaarvoice/emodb

@Override
protected void run(Bootstrap<EmoConfiguration> bootstrap, Namespace namespace, EmoConfiguration emoConfiguration)
    throws Exception {
  _outputOnly = namespace.getBoolean("output_only");
  DdlConfiguration ddlConfiguration = parseDdlConfiguration(toFile(namespace.getString("config-ddl")));
  CuratorFramework curator = null;
  if (!_outputOnly) {
    curator = emoConfiguration.getZooKeeperConfiguration().newCurator();
    curator.start();
  }
  try {
    createKeyspacesIfNecessary(emoConfiguration, ddlConfiguration, curator, bootstrap.getMetricRegistry());
  } finally {
    Closeables.close(curator, true);
  }
}

代码示例来源:origin: bazaarvoice/emodb

String serviceName = namespace.getString("service");
CuratorFramework curator = configuration.getZooKeeperConfiguration().newCurator();
curator.start();

代码示例来源:origin: bazaarvoice/emodb

@Override
  protected void run(Bootstrap<EmoConfiguration> bootstrap, Namespace namespace, EmoConfiguration configuration)
      throws Exception {
    String hostString = namespace.getString("host");
    String serviceName = namespace.getString("service");

    CuratorFramework curator = configuration.getZooKeeperConfiguration().newCurator();
    curator.start();

    HostAndPort host = HostAndPort.fromString(hostString).withDefaultPort(9160);

    ServiceEndPoint endPoint = new ServiceEndPointBuilder()
        .withServiceName(serviceName)
        .withId(host.toString())
        .build();

    String dir = ZKPaths.makePath("ostrich", endPoint.getServiceName());
    String path = ZKPaths.makePath(dir, endPoint.getId());

    curator.newNamespaceAwareEnsurePath(dir).ensure(curator.getZookeeperClient());
    try {
      curator.delete().forPath(path);
      System.out.println("Deleted.");
    } catch (KeeperException.NoNodeException e) {
      System.out.println("Not found.");
    }

    curator.close();
  }
}

代码示例来源:origin: bazaarvoice/ostrich

CuratorFramework curator = config.getZooKeeperConfiguration().newCurator();
curator.start();

代码示例来源:origin: bazaarvoice/emodb

CuratorFramework curator = _configuration.getZooKeeperConfiguration().newCurator();
try {
  CreateKeyspacesCommand createKeyspacesCommand = new CreateKeyspacesCommand();

代码示例来源:origin: bazaarvoice/ostrich

CuratorFramework curator = config.getZooKeeperConfiguration().newCurator();
curator.start();

代码示例来源:origin: bazaarvoice/ostrich

CuratorFramework curator = config.getZooKeeperConfiguration().newCurator();
curator.start();

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