当前位置: 首页>>代码示例>>Java>>正文


Java LocalBookKeeper.waitForServerUp方法代码示例

本文整理汇总了Java中org.apache.bookkeeper.util.LocalBookKeeper.waitForServerUp方法的典型用法代码示例。如果您正苦于以下问题:Java LocalBookKeeper.waitForServerUp方法的具体用法?Java LocalBookKeeper.waitForServerUp怎么用?Java LocalBookKeeper.waitForServerUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.bookkeeper.util.LocalBookKeeper的用法示例。


在下文中一共展示了LocalBookKeeper.waitForServerUp方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupZooKeeper

import org.apache.bookkeeper.util.LocalBookKeeper; //导入方法依赖的package包/类
@BeforeClass
public static void setupZooKeeper() throws Exception {
  LOG.info("Starting ZK server");
  zkTmpDir = File.createTempFile("zookeeper", "test");
  zkTmpDir.delete();
  zkTmpDir.mkdir();
  try {
    zks = new ZooKeeperServer(zkTmpDir, zkTmpDir, ZooKeeperDefaultPort);
    serverFactory = new NIOServerCnxnFactory();
    serverFactory.configure(new InetSocketAddress(ZooKeeperDefaultPort), 10);
    serverFactory.startup(zks);
  } catch (Exception e) {
    LOG.error("Exception while instantiating ZooKeeper", e);
  }
  boolean b = LocalBookKeeper.waitForServerUp(HOSTPORT, CONNECTION_TIMEOUT);
  LOG.debug("ZooKeeper server up: " + b);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:TestCurrentInprogress.java

示例2: setupZooKeeper

import org.apache.bookkeeper.util.LocalBookKeeper; //导入方法依赖的package包/类
@BeforeClass
public static void setupZooKeeper() throws Exception {
  // create a ZooKeeper server(dataDir, dataLogDir, port)
  LOG.info("Starting ZK server");
  ZkTmpDir = File.createTempFile("zookeeper", "test");
  ZkTmpDir.delete();
  ZkTmpDir.mkdir();

  try {
    zks = new ZooKeeperServer(ZkTmpDir, ZkTmpDir, ZooKeeperDefaultPort);
    serverFactory = new NIOServerCnxnFactory();
    serverFactory.configure(new InetSocketAddress(ZooKeeperDefaultPort), 10);
    serverFactory.startup(zks);
  } catch (Exception e) {
    LOG.error("Exception while instantiating ZooKeeper", e);
  }

  boolean b = LocalBookKeeper.waitForServerUp(HOSTPORT, CONNECTION_TIMEOUT);
  LOG.debug("ZooKeeper server up: " + b);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestBookKeeperConfiguration.java

示例3: start

import org.apache.bookkeeper.util.LocalBookKeeper; //导入方法依赖的package包/类
void start() throws Exception {
  bkthread.start();
  if (!LocalBookKeeper.waitForServerUp(zkEnsemble, 10000)) {
    throw new Exception("Error starting zookeeper/bookkeeper");
  }
  assertEquals("Not all bookies started",
               numBookies, checkBookiesUp(numBookies, 10));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:BKJMUtil.java

示例4: start

import org.apache.bookkeeper.util.LocalBookKeeper; //导入方法依赖的package包/类
public void start() throws Exception {
    bkStartupThread.start();
    if (!LocalBookKeeper.waitForServerUp(zkEnsemble, zkTimeoutSec*1000)) {
        throw new Exception("Error starting zookeeper/bookkeeper");
    }
    int bookiesUp = checkBookiesUp(numBookies, zkTimeoutSec);
    assert (numBookies == bookiesUp);
    // Provision "/messaging/distributedlog" namespace
    DLMetadata.create(new BKDLConfig(zkEnsemble, "/ledgers")).create(uri);
}
 
开发者ID:twitter,项目名称:distributedlog,代码行数:11,代码来源:LocalDLMEmulator.java

示例5: waitForServerUp

import org.apache.bookkeeper.util.LocalBookKeeper; //导入方法依赖的package包/类
/**
 * Blocks the current thread and awaits ZooKeeper to start running locally on the given port.
 *
 * @param zkPort The ZooKeeper Port.
 * @return True if ZooKeeper started within a specified timeout, false otherwise.
 */
public static boolean waitForServerUp(int zkPort) {
    val address = LOOPBACK_ADDRESS.getHostAddress() + ":" + zkPort;
    return LocalBookKeeper.waitForServerUp(address, LocalBookKeeper.CONNECTION_TIMEOUT);
}
 
开发者ID:pravega,项目名称:pravega,代码行数:11,代码来源:ZooKeeperServiceRunner.java


注:本文中的org.apache.bookkeeper.util.LocalBookKeeper.waitForServerUp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。