本文整理了Java中com.yahoo.cloud.config.ZookeeperServerConfig
类的一些代码示例,展示了ZookeeperServerConfig
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZookeeperServerConfig
类的具体详情如下:
包路径:com.yahoo.cloud.config.ZookeeperServerConfig
类名称:ZookeeperServerConfig
[英]This class represents the root node of zookeeper-server Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
[中]此类代表zookeeper server Copyright 2017 Yahoo Holdings的根节点。根据Apache 2.0许可证的条款获得许可。请参阅项目根目录中的许可证。
代码示例来源:origin: com.yahoo.vespa/zkfacade
ZooKeeperServer(ZookeeperServerConfig zookeeperServerConfig, boolean startServer) {
this.zookeeperServerConfig = zookeeperServerConfig;
System.setProperty("zookeeper.jmx.log4j.disable", "true");
System.setProperty(ZOOKEEPER_JUTE_MAX_BUFFER, "" + zookeeperServerConfig.juteMaxBuffer());
System.setProperty("zookeeper.serverCnxnFactory", "com.yahoo.vespa.zookeeper.RestrictedServerCnxnFactory");
writeConfigToDisk(zookeeperServerConfig);
zkServerThread = new Thread(this, "zookeeper server");
if (startServer) {
zkServerThread.start();
}
}
代码示例来源:origin: com.yahoo.vespa/zkfacade
private void writeMyIdFile(ZookeeperServerConfig config) throws IOException {
if (config.server().size() > 1) {
try (FileWriter writer = new FileWriter(getDefaults().underVespaHome(config.myidFile()))) {
writer.write(config.myid() + "\n");
}
}
}
代码示例来源:origin: com.yahoo.vespa/configdefinitions
public Builder(ZookeeperServerConfig config) {
zooKeeperConfigFile(config.zooKeeperConfigFile());
tickTime(config.tickTime());
initLimit(config.initLimit());
syncLimit(config.syncLimit());
maxClientConnections(config.maxClientConnections());
dataDir(config.dataDir());
clientPort(config.clientPort());
snapshotCount(config.snapshotCount());
autopurge(new Autopurge.Builder(config.autopurge()));
myidFile(config.myidFile());
juteMaxBuffer(config.juteMaxBuffer());
myid(config.myid());
for (Server s : config.server()) {
server(new Server.Builder(s));
}
}
代码示例来源:origin: com.yahoo.vespa/zkfacade
private String transformConfigToString(ZookeeperServerConfig config) {
StringBuilder sb = new StringBuilder();
sb.append("tickTime=").append(config.tickTime()).append("\n");
sb.append("initLimit=").append(config.initLimit()).append("\n");
sb.append("syncLimit=").append(config.syncLimit()).append("\n");
sb.append("maxClientCnxns=").append(config.maxClientConnections()).append("\n");
sb.append("snapCount=").append(config.snapshotCount()).append("\n");
sb.append("dataDir=").append(getDefaults().underVespaHome(config.dataDir())).append("\n");
sb.append("clientPort=").append(config.clientPort()).append("\n");
sb.append("autopurge.purgeInterval=").append(config.autopurge().purgeInterval()).append("\n");
sb.append("autopurge.snapRetainCount=").append(config.autopurge().snapRetainCount()).append("\n");
// See http://zookeeper.apache.org/doc/r3.4.13/zookeeperAdmin.html#sc_zkCommands
// Includes all available commands in 3.4, except 'wchc' and 'wchp'
// Mandatory when using ZooKeeper 3.5
sb.append("4lw.commands.whitelist=conf,cons,crst,dump,envi,mntr,ruok,srst,srvr,stat,wchs").append("\n");
if (config.server().size() > 1) {
ensureThisServerIsRepresented(config.myid(), config.server());
for (ZookeeperServerConfig.Server server : config.server()) {
addServerToCfg(sb, server);
}
}
return sb.toString();
}
代码示例来源:origin: com.yahoo.vespa/zkfacade
private static Set<String> zookeeperServerHostnames(ZookeeperServerConfig zookeeperServerConfig) {
return zookeeperServerConfig.server().stream().map(ZookeeperServerConfig.Server::hostname).collect(Collectors.toSet());
}
内容来源于网络,如有侵权,请联系作者删除!