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

x33g5p2x  于2022-02-05 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(135)

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

ZooKeeperServerMain.runFromConfig介绍

[英]Run from a ServerConfig.
[中]从服务器配置运行。

代码示例

代码示例来源:origin: apache/flume

public void run() {
  try {
   zooKeeperServer.runFromConfig(configuration);
  } catch (IOException e) {
   logger.error("Zookeeper startup failed.", e);
  }
 }
}.start();

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

super.runFromConfig(newServerConfig);

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

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

代码示例来源: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: FlowCI/flow-platform

@Override
  public void runFromConfig(ServerConfig config) throws IOException {
    isStarted = true;
    super.runFromConfig(config);
  }
}

代码示例来源: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: apache/directory-kerby

public void run() {
      try {
        zooKeeperServer.runFromConfig(configuration);
      } catch (IOException e) {
        LOG.warn(e.getMessage());
      }
    }
};

代码示例来源: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: com.netflix.curator/curator-test

@Override
public void runFromConfig(QuorumPeerConfig config) throws Exception
{
  ServerConfig        serverConfig = new ServerConfig();
  serverConfig.readFrom(config);
  latch.countDown();
  super.runFromConfig(serverConfig);
}

代码示例来源:origin: stackoverflow.com

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

代码示例来源: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: 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);
 }
}

代码示例来源: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);

  }
}

相关文章