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


Java BookieServer.suspendProcessing方法代码示例

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


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

示例1: sleepBookie

import org.apache.bookkeeper.proto.BookieServer; //导入方法依赖的package包/类
/**
 * Sleep a bookie until I count down the latch
 *
 * @param latch
 *          latch to wait on
 * @param bookie
 *          bookie server
 * @throws Exception
 */
private void sleepBookie(final CountDownLatch latch, final BookieServer bookie)
    throws Exception {

  Thread sleeper = new Thread() {
    public void run() {
      try {
        bookie.suspendProcessing();
        latch.await(2, TimeUnit.MINUTES);
        bookie.resumeProcessing();
      } catch (Exception e) {
        LOG.error("Error suspending bookie", e);
      }
    }
  };
  sleeper.setName("BookieServerSleeper-" + bookie.getBookie().getId());
  sleeper.start();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:TestBookKeeperSpeculativeRead.java

示例2: sleepBookie

import org.apache.bookkeeper.proto.BookieServer; //导入方法依赖的package包/类
/**
 * Sleep a bookie until I count down the latch
 *
 * @param latch
 *          Latch to wait on
 * @param bookie
 *          bookie server
 * @throws Exception
 */
private void sleepBookie(final CountDownLatch l, final BookieServer bookie)
    throws Exception {

  Thread sleeper = new Thread() {
    public void run() {
      try {
        bookie.suspendProcessing();
        l.await(60, TimeUnit.SECONDS);
        bookie.resumeProcessing();
      } catch (Exception e) {
        LOG.error("Error suspending bookie", e);
      }
    }
  };
  sleeper.setName("BookieServerSleeper-" + bookie.getBookie().getId());
  sleeper.start();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:TestBookKeeperJournalManager.java

示例3: sleepBookie

import org.apache.bookkeeper.proto.BookieServer; //导入方法依赖的package包/类
/**
 * Sleep a bookie
 *
 * @param addr
 *            Socket Address
 * @param seconds
 *            Sleep seconds
 * @return Count Down latch which will be counted down when sleep finishes
 * @throws InterruptedException
 * @throws IOException
 */
public CountDownLatch sleepBookie(InetSocketAddress addr, final int seconds) throws Exception {
    for (final BookieServer bookie : bs) {
        if (bookie.getLocalAddress().equals(addr)) {
            final CountDownLatch l = new CountDownLatch(1);
            Thread sleeper = new Thread() {
                @Override
                public void run() {
                    try {
                        bookie.suspendProcessing();
                        l.countDown();
                        Thread.sleep(seconds * 1000);
                        bookie.resumeProcessing();
                    } catch (Exception e) {
                        LOG.error("Error suspending bookie", e);
                    }
                }
            };
            sleeper.start();
            return l;
        }
    }
    throw new IOException("Bookie not found");
}
 
开发者ID:apache,项目名称:incubator-pulsar,代码行数:35,代码来源:BookKeeperClusterTestCase.java


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