public static void main(String[] args) { ZooKeeperServerMain main = new ZooKeeperServerMain(); try { main.initializeAndRun(args); } catch (IllegalArgumentException e) { LOG.error("Invalid arguments, exiting abnormally", e); LOG.info(USAGE); System.err.println(USAGE); System.exit(2); } catch (ConfigException e) { LOG.error("Invalid config, exiting abnormally", e); System.err.println("Invalid config, exiting abnormally"); System.exit(2); } catch (Exception e) { LOG.error("Unexpected exception, exiting abnormally", e); System.exit(1); } LOG.info("Exiting normally"); System.exit(0); }
public static void main(String[] args) { ZooKeeperServerMain main = new ZooKeeperServerMain(); try { main.initializeAndRun(args); } catch (IllegalArgumentException e) { LOG.error("Invalid arguments, exiting abnormally", e); LOG.info(USAGE); System.err.println(USAGE); System.exit(ExitCode.INVALID_INVOCATION.getValue()); } catch (ConfigException e) { LOG.error("Invalid config, exiting abnormally", e); System.err.println("Invalid config, exiting abnormally"); System.exit(ExitCode.INVALID_INVOCATION.getValue()); } catch (DatadirException e) { LOG.error("Unable to access datadir, exiting abnormally", e); System.err.println("Unable to access datadir, exiting abnormally"); System.exit(ExitCode.UNABLE_TO_ACCESS_DATADIR.getValue()); } catch (AdminServerException e) { LOG.error("Unable to start AdminServer, exiting abnormally", e); System.err.println("Unable to start AdminServer, exiting abnormally"); System.exit(ExitCode.ERROR_STARTING_ADMIN_SERVER.getValue()); } catch (Exception e) { LOG.error("Unexpected exception, exiting abnormally", e); System.exit(ExitCode.UNEXPECTED_ERROR.getValue()); } LOG.info("Exiting normally"); System.exit(ExitCode.EXECUTION_FINISHED.getValue()); }
@Override public void run() { try { Properties properties = new Properties(); File file = new File(System.getProperty("java.io.tmpdir") + File.separator + UUID.randomUUID()); file.deleteOnExit(); properties.setProperty("dataDir", file.getAbsolutePath()); properties.setProperty("clientPort", String.valueOf(clientPort)); QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig(); quorumPeerConfig.parseProperties(properties); zkServer = new ZooKeeperServerMain(); ServerConfig configuration = new ServerConfig(); configuration.readFrom(quorumPeerConfig); zkServer.runFromConfig(configuration); } catch (Exception e) { if (errorHandler != null) { errorHandler.handleError(e); } else { logger.error("Exception running embedded ZooKeeper", e); } } } }
private static void runZKServer(QuorumPeerConfig zkConfig) throws UnknownHostException, IOException { if (zkConfig.isDistributed()) { QuorumPeerMain qp = new QuorumPeerMain(); qp.runFromConfig(zkConfig); } else { ZooKeeperServerMain zk = new ZooKeeperServerMain(); ServerConfig serverConfig = new ServerConfig(); serverConfig.readFrom(zkConfig); zk.runFromConfig(serverConfig); } }
zooKeeperServer = new ZooKeeperServerMain(); final ServerConfig configuration = new ServerConfig(); configuration.readFrom(quorumConfiguration);
zooKeeperServer = new ZooKeeperServerMain(); final ServerConfig configuration = new ServerConfig(); configuration.readFrom(quorumConfiguration);
public ZooKeeperLocal(Properties zkProperties) throws IOException { QuorumPeerConfig quorumConfiguration = new QuorumPeerConfig(); try { quorumConfiguration.parseProperties(zkProperties); } catch (Exception e) { throw new RuntimeException(e); } zooKeeperServer = new ZooKeeperServerMain(); final ServerConfig configuration = new ServerConfig(); configuration.readFrom(quorumConfiguration); new Thread() { public void run() { try { zooKeeperServer.runFromConfig(configuration); } catch (IOException e) { logger.error("Zookeeper startup failed.", e); } } }.start(); } }
public static void main(String[] args) throws Exception { QuorumPeerConfig config = new QuorumPeerConfig(); InputStream is = ZKStartup.class.getResourceAsStream("/zookeeper.properties"); Properties p = new Properties(); p.load(is); config.parseProperties(p); ServerConfig serverconfig = new ServerConfig(); serverconfig.readFrom(config); new ZooKeeperServerMain().runFromConfig(serverconfig); } }
new Thread(new Runnable() { @Override public void run() { try{ ZooKeeperServerMain zk = new ZooKeeperServerMain() zk.runFromConfig(config1); }catch(Exception e){ e.printStackTrace(); } } }).start();
public static void main(String[] args) { ZooKeeperServerMain main = new ZooKeeperServerMain(); try { main.initializeAndRun(args); } catch (IllegalArgumentException e) { LOG.fatal("Invalid arguments, exiting abnormally", e); LOG.info(USAGE); System.err.println(USAGE); System.exit(2); } catch (ConfigException e) { LOG.fatal("Invalid config, exiting abnormally", e); System.err.println("Invalid config, exiting abnormally"); System.exit(2); } catch (Exception e) { LOG.fatal("Unexpected exception, exiting abnormally", e); System.exit(1); } LOG.info("Exiting normally"); System.exit(0); }
@Override public void run() { try { ZooKeeperServerMain zs = new ZooKeeperServerMain(); zs.runFromConfig(sc); _logger.info("[Distribution] distribution server started up.... host:" + sc.getClientPortAddress().getHostName() + ";address:" + sc.getClientPortAddress().getAddress().getHostAddress() + ";port:" + sc.getClientPortAddress().getPort()); } catch (Exception e) { _logger.error(e, e); cleanIfStartsError(); } _logger.info("[Distribution] distribution server shutdown...."); } };
@Override public void run() { try { Properties properties = new Properties(); File file = new File(System.getProperty("java.io.tmpdir") + File.separator + UUID.randomUUID()); file.deleteOnExit(); properties.setProperty("dataDir", file.getAbsolutePath()); properties.setProperty("clientPort", String.valueOf(clientPort)); QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig(); quorumPeerConfig.parseProperties(properties); zkServer = new ZooKeeperServerMain(); ServerConfig configuration = new ServerConfig(); configuration.readFrom(quorumPeerConfig); zkServer.runFromConfig(configuration); } catch (Exception e) { if (errorHandler != null) { errorHandler.handleError(e); } else { logger.error("Exception running embedded ZooKeeper", e); } } } }
ServerConfig config = new ServerConfig(); config.parse(new String[] {port, dir}); ZooKeeperServerMain zk = new ZooKeeperServerMain(); zk.runFromConfig(config);
private static void runZKServer(QuorumPeerConfig zkConfig) throws UnknownHostException, IOException { if (zkConfig.isDistributed()) { QuorumPeerMain qp = new QuorumPeerMain(); qp.runFromConfig(zkConfig); } else { ZooKeeperServerMain zk = new ZooKeeperServerMain(); ServerConfig serverConfig = new ServerConfig(); serverConfig.readFrom(zkConfig); zk.runFromConfig(serverConfig); } }
public void run() throws Exception { pidFileLocker.lock(); server = new ZooKeeperServerMain(); QuorumPeerConfig qp = new QuorumPeerConfig(); qp.parseProperties(configuration); ServerConfig sc = new ServerConfig(); sc.readFrom(qp); server.runFromConfig(sc); } }
private static void runZKServer(QuorumPeerConfig zkConfig) throws UnknownHostException, IOException { if (zkConfig.isDistributed()) { QuorumPeerMain qp = new QuorumPeerMain(); qp.runFromConfig(zkConfig); } else { ZooKeeperServerMain zk = new ZooKeeperServerMain(); ServerConfig serverConfig = new ServerConfig(); serverConfig.readFrom(zkConfig); zk.runFromConfig(serverConfig); } }
private static void runZKServer(QuorumPeerConfig zkConfig) throws UnknownHostException, IOException { if (zkConfig.isDistributed()) { QuorumPeerMain qp = new QuorumPeerMain(); qp.runFromConfig(zkConfig); } else { ZooKeeperServerMain zk = new ZooKeeperServerMain(); ServerConfig serverConfig = new ServerConfig(); serverConfig.readFrom(zkConfig); zk.runFromConfig(serverConfig); } }
private static void runZKServer(QuorumPeerConfig zkConfig) throws UnknownHostException, IOException { if (zkConfig.isDistributed()) { QuorumPeerMain qp = new QuorumPeerMain(); qp.runFromConfig(zkConfig); } else { ZooKeeperServerMain zk = new ZooKeeperServerMain(); ServerConfig serverConfig = new ServerConfig(); serverConfig.readFrom(zkConfig); zk.runFromConfig(serverConfig); } }
private static void runZKServer(QuorumPeerConfig zkConfig) throws UnknownHostException, IOException { if (zkConfig.isDistributed()) { QuorumPeerMain qp = new QuorumPeerMain(); qp.runFromConfig(zkConfig); } else { ZooKeeperServerMain zk = new ZooKeeperServerMain(); ServerConfig serverConfig = new ServerConfig(); serverConfig.readFrom(zkConfig); zk.runFromConfig(serverConfig); } }
private static void runZKServer(QuorumPeerConfig zkConfig) throws UnknownHostException, IOException { if (zkConfig.isDistributed()) { QuorumPeerMain qp = new QuorumPeerMain(); qp.runFromConfig(zkConfig); } else { ZooKeeperServerMain zk = new ZooKeeperServerMain(); ServerConfig serverConfig = new ServerConfig(); serverConfig.readFrom(zkConfig); zk.runFromConfig(serverConfig); } }