protected org.apache.hw_v4_2_0.bookkeeper.conf.ServerConfiguration newServerConfiguration( int port, String zkServers, File journalDir, File[] ledgerDirs) { org.apache.hw_v4_2_0.bookkeeper.conf.ServerConfiguration conf = new org.apache.hw_v4_2_0.bookkeeper.conf.ServerConfiguration(); conf.setBookiePort(port); conf.setZkServers(zkServers); conf.setJournalDirName(journalDir.getPath()); String[] ledgerDirNames = new String[ledgerDirs.length]; for (int i = 0; i < ledgerDirs.length; i++) { ledgerDirNames[i] = ledgerDirs[i].getPath(); } conf.setLedgerDirNames(ledgerDirNames); return conf; }
protected org.apache.hw_v4_2_0.bookkeeper.proto.BookieServer startBookie( org.apache.hw_v4_2_0.bookkeeper.conf.ServerConfiguration conf) throws Exception { org.apache.hw_v4_2_0.bookkeeper.proto.BookieServer server = new org.apache.hw_v4_2_0.bookkeeper.proto.BookieServer(conf); server.start(); int port = conf.getBookiePort(); while (zkUtil .getZooKeeperClient() .exists( "/ledgers/available/" + InetAddress.getLocalHost().getHostAddress() + ":" + port, false) == null) { Thread.sleep(500); } return server; }