List of usage examples for org.apache.zookeeper ZooKeeperMain main
public static void main(String[] args) throws CliException, IOException, InterruptedException
From source file:org.apache.hadoop.hbase.zookeeper.ZKMainServer.java
License:Apache License
/** * Run the tool./*from w w w. j av a 2s .c o m*/ * @param args Command line arguments. First arg is path to zookeepers file. */ public static void main(String[] args) throws Exception { String[] newArgs = args; if (!hasServer(args)) { // Add the zk ensemble from configuration if none passed on command-line. Configuration conf = HBaseConfiguration.create(); String hostport = new ZKMainServer().parse(conf); if (hostport != null && hostport.length() > 0) { newArgs = new String[args.length + 2]; System.arraycopy(args, 0, newArgs, 2, args.length); newArgs[0] = "-server"; newArgs[1] = hostport; } } // If command-line arguments, run our hack so they are executed. // ZOOKEEPER-1897 was committed to zookeeper-3.4.6 but elsewhere in this class we say // 3.4.6 breaks command-processing; TODO. if (hasCommandLineArguments(args)) { HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain zkm = new HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain(newArgs); zkm.runCmdLine(); } else { ZooKeeperMain.main(newArgs); } }
From source file:org.apache.hadoop.hbase.zookeeper.ZooKeeperMainServer.java
License:Apache License
/** * Run the tool./*from w w w . j a v a 2 s .co m*/ * @param args Command line arguments. First arg is path to zookeepers file. */ public static void main(String args[]) throws Exception { String[] newArgs = args; if (!hasServer(args)) { // Add the zk ensemble from configuration if none passed on command-line. Configuration conf = HBaseConfiguration.create(); String hostport = new ZooKeeperMainServer().parse(conf); if (hostport != null && hostport.length() > 0) { newArgs = new String[args.length + 2]; System.arraycopy(args, 0, newArgs, 2, args.length); newArgs[0] = "-server"; newArgs[1] = hostport; } } // If command-line arguments, run our hack so they are executed. if (hasCommandLineArguments(args)) { HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain zkm = new HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain(newArgs); zkm.runCmdLine(); } else { ZooKeeperMain.main(newArgs); } }