gpt4 book ai didi

com.bazaarvoice.curator.dropwizard.ZooKeeperConfiguration类的使用及代码示例

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

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

ZooKeeperConfiguration介绍

[英]Jackson friendly object for holding configuration information about a ZooKeeper ensemble.
[中]Jackson友好对象,用于保存ZooKeeper集合的配置信息。

代码示例

代码示例来源: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: 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 Environment} parameter.
 *
 * @deprecated Use {@link #newManagedCurator(LifecycleEnvironment)} instead.
 */
@Deprecated
public CuratorFramework newManagedCurator(Environment env) {
  return newManagedCurator(env.lifecycle());
}

代码示例来源: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

/** Connect to ZooKeeper. */
@Provides @Singleton @Global
CuratorFramework provideCuratorFramework(ZooKeeperConfiguration configuration, Environment environment) {
  CuratorFramework curator = configuration.newManagedCurator(environment.lifecycle());
  curator.start();
  return curator;
}

代码示例来源: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/ostrich

.build();
final CuratorFramework curator = config.getZooKeeperConfiguration().newManagedCurator(env.lifecycle());
env.lifecycle().manage(new Managed() {
  ZooKeeperServiceRegistry registry = new ZooKeeperServiceRegistry(curator, env.metrics());

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

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

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

.build();
final CuratorFramework curator = config.getZooKeeperConfiguration().newManagedCurator(env.lifecycle());
env.lifecycle().manage(new Managed() {
  ZooKeeperServiceRegistry registry = new ZooKeeperServiceRegistry(curator, env.metrics());

代码示例来源: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