gpt4 book ai didi

org.apache.hadoop.hbase.zookeeper.ZKMainServer.main()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 18:27:31 27 4
gpt4 key购买 nike

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

ZKMainServer.main介绍

[英]Run the tool.
[中]运行工具。

代码示例

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

/**
 * We need delete of a znode to work at least.
 */
@Test
public void testCommandLineWorks() throws Exception {
 System.setSecurityManager(new NoExitSecurityManager());
 HBaseZKTestingUtility htu = new HBaseZKTestingUtility();
 // Make it long so for sure succeeds.
 htu.getConfiguration().setInt(HConstants.ZK_SESSION_TIMEOUT, 30000);
 htu.startMiniZKCluster();
 try {
  ZKWatcher zkw = htu.getZooKeeperWatcher();
  String znode = "/testCommandLineWorks";
  ZKUtil.createWithParents(zkw, znode, HConstants.EMPTY_BYTE_ARRAY);
  ZKUtil.checkExists(zkw, znode);
  boolean exception = false;
  try {
   ZKMainServer.main(new String [] {"-server",
    "localhost:" + htu.getZkCluster().getClientPort(), "delete", znode});
  } catch (ExitException ee) {
   // ZKMS calls System.exit which should trigger this exception.
   exception = true;
  }
  assertTrue(exception);
  assertEquals(-1, ZKUtil.checkExists(zkw, znode));
 } finally {
  htu.shutdownMiniZKCluster();
  System.setSecurityManager(null); // or save and restore original
 }
}

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

/**
 * We need delete of a znode to work at least.
 */
@Test
public void testCommandLineWorks() throws Exception {
 System.setSecurityManager(new NoExitSecurityManager());
 HBaseZKTestingUtility htu = new HBaseZKTestingUtility();
 // Make it long so for sure succeeds.
 htu.getConfiguration().setInt(HConstants.ZK_SESSION_TIMEOUT, 30000);
 htu.startMiniZKCluster();
 try {
  ZKWatcher zkw = htu.getZooKeeperWatcher();
  String znode = "/testCommandLineWorks";
  ZKUtil.createWithParents(zkw, znode, HConstants.EMPTY_BYTE_ARRAY);
  ZKUtil.checkExists(zkw, znode);
  boolean exception = false;
  try {
   ZKMainServer.main(new String [] {"-server",
    "localhost:" + htu.getZkCluster().getClientPort(), "delete", znode});
  } catch (ExitException ee) {
   // ZKMS calls System.exit which should trigger this exception.
   exception = true;
  }
  assertTrue(exception);
  assertEquals(-1, ZKUtil.checkExists(zkw, znode));
 } finally {
  htu.shutdownMiniZKCluster();
  System.setSecurityManager(null); // or save and restore original
 }
}

代码示例来源:origin: com.aliyun.hbase/alihbase-zookeeper

/**
 * We need delete of a znode to work at least.
 */
@Test
public void testCommandLineWorks() throws Exception {
 System.setSecurityManager(new NoExitSecurityManager());
 HBaseZKTestingUtility htu = new HBaseZKTestingUtility();
 // Make it long so for sure succeeds.
 htu.getConfiguration().setInt(HConstants.ZK_SESSION_TIMEOUT, 30000);
 htu.startMiniZKCluster();
 try {
  ZKWatcher zkw = htu.getZooKeeperWatcher();
  String znode = "/testCommandLineWorks";
  ZKUtil.createWithParents(zkw, znode, HConstants.EMPTY_BYTE_ARRAY);
  ZKUtil.checkExists(zkw, znode);
  boolean exception = false;
  try {
   ZKMainServer.main(new String [] {"-server",
    "localhost:" + htu.getZkCluster().getClientPort(), "delete", znode});
  } catch (ExitException ee) {
   // ZKMS calls System.exit which should trigger this exception.
   exception = true;
  }
  assertTrue(exception);
  assertEquals(-1, ZKUtil.checkExists(zkw, znode));
 } finally {
  htu.shutdownMiniZKCluster();
  System.setSecurityManager(null); // or save and restore original
 }
}

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