public void parse(String path) throws QuorumPeerConfig.ConfigException { config.parse(path); }
public void parse(String[] args) { config.parse(args); }
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); }
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); }
@Test(expected=IllegalArgumentException.class) public void testFewArguments() { String[] args = {"2181"}; serverConfig.parse(args); }
@Test(expected=IllegalArgumentException.class) public void testTooManyArguments() { String[] args = {"2181", "/data/dir", "60000", "10000", "9999"}; serverConfig.parse(args); }
@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()); }
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); } }
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); }
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); }
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 ..."); } }
ServerConfig config = new ServerConfig(); config.parse(new String[] {port, dir}); ZooKeeperServerMain zk = new ZooKeeperServerMain(); zk.runFromConfig(config);
private static ZooServer runZookeeperServer(String[] args) { zkSystemProps(); ServerConfig config = new ServerConfig(); config.parse(args); ZooServer zksm = new ZooServer(config); zksm.setupFromConfig(); return zksm; } }
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; }
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(); } } }