本文整理了Java中org.apache.zookeeper.server.ServerConfig.parse()方法的一些代码示例,展示了ServerConfig.parse()的具体用法。这些代
本文整理了Java中org.apache.zookeeper.server.ServerConfig.parse()
方法的一些代码示例,展示了ServerConfig.parse()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ServerConfig.parse()
方法的具体详情如下:
包路径:org.apache.zookeeper.server.ServerConfig
类名称:ServerConfig
方法名:parse
ServerConfig.parse介绍
[英]Parse a ZooKeeper configuration file
[中]解析ZooKeeper配置文件
代码示例
代码示例来源:origin: apache/incubator-pinot
public void parse(String path)
throws QuorumPeerConfig.ConfigException {
config.parse(path);
}
代码示例来源:origin: apache/incubator-pinot
public void parse(String[] args) {
config.parse(args);
}
代码示例来源:origin: apache/zookeeper
protected void initializeAndRun(String[] args)
throws ConfigException, IOException, AdminServerException
{
try {
ManagedUtil.registerLog4jMBeans();
} catch (JMException e) {
LOG.warn("Unable to register log4j JMX control", e);
}
ServerConfig cOnfig= new ServerConfig();
if (args.length == 1) {
config.parse(args[0]);
} else {
config.parse(args);
}
runFromConfig(config);
}
代码示例来源:origin: org.apache.zookeeper/zookeeper
protected void initializeAndRun(String[] args)
throws ConfigException, IOException
{
try {
ManagedUtil.registerLog4jMBeans();
} catch (JMException e) {
LOG.warn("Unable to register log4j JMX control", e);
}
ServerConfig cOnfig= new ServerConfig();
if (args.length == 1) {
config.parse(args[0]);
} else {
config.parse(args);
}
runFromConfig(config);
}
代码示例来源:origin: apache/zookeeper
@Test(expected=IllegalArgumentException.class)
public void testFewArguments() {
String[] args = {"2181"};
serverConfig.parse(args);
}
代码示例来源:origin: apache/zookeeper
@Test(expected=IllegalArgumentException.class)
public void testTooManyArguments() {
String[] args = {"2181", "/data/dir", "60000", "10000", "9999"};
serverConfig.parse(args);
}
代码示例来源:origin: apache/zookeeper
@Test
public void testValidArguments() {
String[] args = {"2181", "/data/dir", "60000", "10000"};
serverConfig.parse(args);
assertEquals(2181, serverConfig.getClientPortAddress().getPort());
assertTrue(checkEquality("/data/dir", serverConfig.getDataDir()));
assertEquals(60000, serverConfig.getTickTime());
assertEquals(10000, serverConfig.getMaxClientCnxns());
}
代码示例来源:origin: jackyhung/consumer-dispatcher
protected void loadDistributionServerConfig(final String configPath) {
sc = new ServerConfig();
try {
sc.parse(configPath);
} catch (ConfigException e) {
_logger.error("[Distribution] error while loading distribution config: " + configPath + e, e);
}
}
代码示例来源:origin: org.apache.hadoop/zookeeper
protected void initializeAndRun(String[] args)
throws ConfigException, IOException
{
try {
ManagedUtil.registerLog4jMBeans();
} catch (JMException e) {
LOG.warn("Unable to register log4j JMX control", e);
}
ServerConfig cOnfig= new ServerConfig();
if (args.length == 1) {
config.parse(args[0]);
} else {
config.parse(args);
}
runFromConfig(config);
}
代码示例来源:origin: org.apache.solr/solr-test-framework
protected void initializeAndRun(String[] args) throws ConfigException,
IOException {
try {
ManagedUtil.registerLog4jMBeans();
} catch (JMException e) {
log.warn("Unable to register log4j JMX control", e);
}
ServerConfig cOnfig= new ServerConfig();
if (args.length == 1) {
config.parse(args[0]);
} else {
config.parse(args);
}
runFromConfig(config);
}
代码示例来源:origin: org.apache.airavata/airavata-common-utils
public static void startEmbeddedZK(ServerCnxnFactory cnxnFactory) {
if (ServerSettings.isEmbeddedZK()) {
ServerConfig serverCOnfig= new ServerConfig();
URL resource = AiravataZKUtils.class.getClassLoader().getResource("zoo.cfg");
if (resource == null) {
logger.error("There is no zoo.cfg file in the classpath... Failed to start Zookeeper Server");
System.exit(1);
}
try {
serverConfig.parse(resource.getPath());
} catch (QuorumPeerConfig.ConfigException e) {
logger.error("Error while starting embedded Zookeeper", e);
System.exit(2);
}
final ServerConfig fServerCOnfig= serverConfig;
final ServerCnxnFactory fserverCnxnFactory = cnxnFactory;
(new Thread() {
public void run() {
try {
AiravataZKUtils.runZKFromConfig(fServerConfig,fserverCnxnFactory);
} catch (IOException e) {
logger.error("Error while starting embedded Zookeeper", e);
System.exit(3);
}
}
}).start();
}else{
logger.info("Skipping Zookeeper embedded startup ...");
}
}
代码示例来源:origin: stackoverflow.com
ServerConfig cOnfig= new ServerConfig();
config.parse(new String[] {port, dir});
ZooKeeperServerMain zk = new ZooKeeperServerMain();
zk.runFromConfig(config);
代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-server-local
private static ZooServer runZookeeperServer(String[] args) {
zkSystemProps();
ServerConfig cOnfig= new ServerConfig();
config.parse(args);
ZooServer zksm = new ZooServer(config);
zksm.setupFromConfig();
return zksm;
}
}
代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-server-local
public static ZooServer runZookeeperServer(String zooConfFile) {
zkSystemProps();
ServerConfig cOnfig= new ServerConfig();
try {
config.parse(zooConfFile);
} catch (ConfigException e) {
FmtLog.error(LOG, "Error in Zookeeper configuration file '%s': %s", zooConfFile, e.getMessage());
throw new IllegalArgumentException(e);
}
ZooServer zksm = new ZooServer(config);
zksm.setupFromConfig();
return zksm;
}
代码示例来源:origin: co.paralleluniverse/galaxy
public static ServerCnxnFactory startZookeeper(final String configResource, final String dataDirName) throws IOException, QuorumPeerConfig.ConfigException {
ServerConfig sc = new ServerConfig();
sc.parse(pathToResource(configResource));
deleteDir(dataDirName);
new File(dataDirName).mkdirs();
FileTxnSnapLog txnLog = null;
try {
ZooKeeperServer zkServer = new ZooKeeperServer();
txnLog = new FileTxnSnapLog(new File(sc.getDataDir()), new File(
sc.getDataDir()));
zkServer.setTxnLogFactory(txnLog);
zkServer.setTickTime(sc.getTickTime());
zkServer.setMinSessionTimeout(sc.getMinSessionTimeout());
zkServer.setMaxSessionTimeout(sc.getMaxSessionTimeout());
ServerCnxnFactory cnxnFactory = ServerCnxnFactory.createFactory();
cnxnFactory.configure(sc.getClientPortAddress(),
sc.getMaxClientCnxns());
cnxnFactory.startup(zkServer);
return cnxnFactory;
} catch (InterruptedException e) {
throw new RuntimeException(e);
} finally {
if (txnLog != null) {
txnLog.close();
}
}
}