本文整理汇总了Java中org.apache.bookkeeper.proto.BookieServer.isRunning方法的典型用法代码示例。如果您正苦于以下问题:Java BookieServer.isRunning方法的具体用法?Java BookieServer.isRunning怎么用?Java BookieServer.isRunning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.bookkeeper.proto.BookieServer
的用法示例。
在下文中一共展示了BookieServer.isRunning方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newBookie
import org.apache.bookkeeper.proto.BookieServer; //导入方法依赖的package包/类
BookieServer newBookie() throws Exception {
int port = nextPort++;
ServerConfiguration bookieConf = new ServerConfiguration();
bookieConf.setBookiePort(port);
File tmpdir = File.createTempFile("bookie" + Integer.toString(port) + "_",
"test");
tmpdir.delete();
tmpdir.mkdir();
bookieConf.setZkServers(zkEnsemble);
bookieConf.setJournalDirName(tmpdir.getPath());
bookieConf.setLedgerDirNames(new String[] { tmpdir.getPath() });
BookieServer b = new BookieServer(bookieConf);
b.start();
for (int i = 0; i < 10 && !b.isRunning(); i++) {
Thread.sleep(10000);
}
if (!b.isRunning()) {
throw new IOException("Bookie would not start");
}
return b;
}
示例2: startNewBookie
import org.apache.bookkeeper.proto.BookieServer; //导入方法依赖的package包/类
/**
* Helper method to startup a new bookie server with the indicated port
* number
*
* @param port
* Port to start the new bookie server on
* @throws IOException
*/
private void startNewBookie(int port)
throws IOException, InterruptedException {
File f = File.createTempFile("bookie", "test");
tmpDirs.add(f);
f.delete();
f.mkdir();
BookieServer server = new BookieServer(port, HOSTPORT, f, new File[] { f });
server.start();
bs.add(server);
while(!server.isRunning()){
Thread.sleep(500);
}
LOG.info("New bookie on port " + port + " has been created.");
}
示例3: newBookie
import org.apache.bookkeeper.proto.BookieServer; //导入方法依赖的package包/类
public BookieServer newBookie() throws Exception {
ServerConfiguration bookieConf = new ServerConfiguration();
bookieConf.setZkTimeout(zkTimeoutSec * 1000);
bookieConf.setBookiePort(0);
bookieConf.setAllowLoopback(true);
File tmpdir = File.createTempFile("bookie" + UUID.randomUUID() + "_",
"test");
if (!tmpdir.delete()) {
LOG.debug("Fail to delete tmpdir " + tmpdir);
}
if (!tmpdir.mkdir()) {
throw new IOException("Fail to create tmpdir " + tmpdir);
}
tmpDirs.add(tmpdir);
bookieConf.setZkServers(zkEnsemble);
bookieConf.setJournalDirName(tmpdir.getPath());
bookieConf.setLedgerDirNames(new String[]{tmpdir.getPath()});
BookieServer b = new BookieServer(bookieConf);
b.start();
for (int i = 0; i < 10 && !b.isRunning(); i++) {
Thread.sleep(10000);
}
if (!b.isRunning()) {
throw new IOException("Bookie would not start");
}
return b;
}