gpt4 book ai didi

org.apache.zookeeper.server.ZooKeeperServerMain.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-16 15:32:40 34 4
gpt4 key购买 nike

本文整理了Java中org.apache.zookeeper.server.ZooKeeperServerMain.<init>()方法的一些代码示例,展示了ZooKeeperServerMain.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperServerMain.<init>()方法的具体详情如下:
包路径:org.apache.zookeeper.server.ZooKeeperServerMain
类名称:ZooKeeperServerMain
方法名:<init>

ZooKeeperServerMain.<init>介绍

暂无

代码示例

代码示例来源: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/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/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/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: aol/micro-server

zooKeeperServer = new ZooKeeperServerMain();
final ServerConfig configuration = new ServerConfig();
configuration.readFrom(quorumConfiguration);

代码示例来源:origin: aol/micro-server

zooKeeperServer = new ZooKeeperServerMain();
final ServerConfig configuration = new ServerConfig();
configuration.readFrom(quorumConfiguration);

代码示例来源: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: 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: stackoverflow.com

new Thread(new Runnable() {      
@Override
public void run()
{
 try{
  ZooKeeperServerMain zk = new ZooKeeperServerMain()
  zk.runFromConfig(config1);
 }catch(Exception e){
  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: jackyhung/consumer-dispatcher

@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....");
  }
};

代码示例来源:origin: apache/incubator-dubbo-samples

@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: stackoverflow.com

ServerConfig config = new ServerConfig();
config.parse(new String[] {port, dir});
ZooKeeperServerMain zk = new ZooKeeperServerMain();
zk.runFromConfig(config);

代码示例来源:origin: org.apache.hama/hama-core

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: diennea/herddb

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);

  }
}

代码示例来源:origin: org.apache.hbase/hbase-zookeeper

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: harbby/presto-connectors

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: alibaba/wasp

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: co.cask.hbase/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/hama

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);
 }
}

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com