本文整理汇总了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();
}
示例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();
}
示例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");
}