本文整理了Java中org.apache.zookeeper.server.ZooKeeperServerMain
类的一些代码示例,展示了ZooKeeperServerMain
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperServerMain
类的具体详情如下:
包路径:org.apache.zookeeper.server.ZooKeeperServerMain
类名称:ZooKeeperServerMain
[英]This class starts and runs a standalone ZooKeeperServer.
[中]这个类启动并运行一个独立的ZookePerserver。
代码示例来源:origin: apache/incubator-dubbo-spring-boot-project
@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);
}
}
}
}
代码示例来源:origin: apache/incubator-pinot
@Override
public void shutdown() {
super.shutdown();
}
}
代码示例来源:origin: org.apache.zookeeper/zookeeper
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);
}
代码示例来源:origin: apache/flume
public void run() {
try {
zooKeeperServer.runFromConfig(configuration);
} catch (IOException e) {
logger.error("Zookeeper startup failed.", e);
}
}
}.start();
代码示例来源:origin: aol/micro-server
zooKeeperServer = new ZooKeeperServerMain();
final ServerConfig configuration = new ServerConfig();
configuration.readFrom(quorumConfiguration);
代码示例来源:origin: apache/incubator-pinot
@Override
public void initializeAndRun(String[] args)
throws QuorumPeerConfig.ConfigException, IOException {
super.initializeAndRun(args);
}
代码示例来源:origin: apache/incubator-pinot
super.runFromConfig(newServerConfig);
代码示例来源:origin: aol/micro-server
zooKeeperServer = new ZooKeeperServerMain();
final ServerConfig configuration = new ServerConfig();
configuration.readFrom(quorumConfiguration);
代码示例来源:origin: uber/chaperone
@Override
public void initializeAndRun(String[] args)
throws QuorumPeerConfig.ConfigException, IOException {
super.initializeAndRun(args);
}
代码示例来源:origin: apache/hbase
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);
}
}
代码示例来源: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: apache/zookeeper
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());
}
代码示例来源:origin: apache/flume
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();
}
}
代码示例来源:origin: apache/zookeeper
public void shutdown() {
super.shutdown();
}
}
代码示例来源:origin: uber/uReplicator
@Override
public void initializeAndRun(String[] args)
throws QuorumPeerConfig.ConfigException, IOException {
super.initializeAndRun(args);
}
代码示例来源:origin: javahongxi/whatsmars
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);
}
}
代码示例来源:origin: aol/micro-server
public void run() {
try {
zooKeeperServer.runFromConfig(configuration);
} catch (IOException e) {
e.printStackTrace();
} catch (AdminServerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}.start();
代码示例来源:origin: org.apache.hadoop/zookeeper
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);
}
代码示例来源:origin: apache/zookeeper
public void shutdown() {
super.shutdown();
}
}
代码示例来源:origin: uber/uReplicator
@Override
public void initializeAndRun(String[] args)
throws QuorumPeerConfig.ConfigException, IOException {
super.initializeAndRun(args);
}
内容来源于网络,如有侵权,请联系作者删除!