gpt4 book ai didi

com.xjeffrose.xio.core.ZooKeeperClientFactory.newClient()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 10:34:49 27 4
gpt4 key购买 nike

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

ZooKeeperClientFactory.newClient介绍

暂无

代码示例

代码示例来源:origin: xjdr/xio

@Test(expected = RuntimeException.class)
 public void testBadConfig() {
  Config config = ConfigFactory.load().getConfig("xio.testApplication.settings");

  Config override =
    ConfigFactory.parseString("zookeeper { client { retry { policy = BadPolicy } } }");
  ZooKeeperClientFactory factory =
    new ZooKeeperClientFactory(override.withFallback(config).getConfig("zookeeper"));

  factory.newClient();
 }
}

代码示例来源:origin: xjdr/xio

public static Configurator build(Config config) {
  Config configurationUpdateServer = config.getConfig("configurationUpdateServer");
  if (configurationUpdateServer.getBoolean("enabled") == false) {
   return new NullConfigurator();
  }
  CuratorFramework client = new ZooKeeperClientFactory(config.getConfig("zookeeper")).newClient();
  client.start();
  ZooKeeperWriteProvider zkWriter = new ZooKeeperWriteProvider(new ThriftMarshaller(), client);
  ZooKeeperReadProvider zkReader = new ZooKeeperReadProvider(new ThriftUnmarshaller(), client);

  Config configurationManager = config.getConfig("configurationManager");
  Ruleset rules = new Ruleset(configurationManager);
  rules.read(zkReader);
  ZooKeeperUpdateHandler zkUpdater = new ZooKeeperUpdateHandler(zkWriter, rules);
  ZooKeeperValidator zkValidator = new ZooKeeperValidator(zkReader, rules, configurationManager);

  Duration writeInterval = configurationUpdateServer.getDuration("writeInterval");
  InetSocketAddress serverAddress =
    new InetSocketAddress(
      configurationUpdateServer.getString("bindIp"),
      configurationUpdateServer.getInt("bindPort"));
  Configurator server =
    new Configurator(zkUpdater, writeInterval, serverAddress, rules, zkValidator);
  return server;
 }
}

代码示例来源:origin: xjdr/xio

@Test
public void testConfigs() {
 Config config = ConfigFactory.load().getConfig("xio.testApplication.settings");
 for (ZooKeeperClientFactory.ClientRetryPolicy policy :
   ZooKeeperClientFactory.ClientRetryPolicy.values()) {
  Config override =
    ConfigFactory.parseString(
      "zookeeper { client { retry { policy = " + policy.name() + "} } }");
  ZooKeeperClientFactory factory =
    new ZooKeeperClientFactory(override.withFallback(config).getConfig("zookeeper"));
  factory.newClient();
  assertTrue(true); // no exception thrown
 }
}

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