本文整理了Java中com.xjeffrose.xio.core.ZooKeeperClientFactory.<init>()
方法的一些代码示例,展示了ZooKeeperClientFactory.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperClientFactory.<init>()
方法的具体详情如下:
包路径:com.xjeffrose.xio.core.ZooKeeperClientFactory
类名称:ZooKeeperClientFactory
方法名:<init>
暂无
代码示例来源: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
}
}
内容来源于网络,如有侵权,请联系作者删除!