protected void startBookieServer() throws Exception { int port = PortManager.nextFreePort(); File tmpDir = org.apache.hedwig.util.FileUtils.createTempDirectory(getClass().getName() + port, "test"); org.apache.bookkeeper.conf.ServerConfiguration conf = newServerConfiguration( port, zkUtil.getZooKeeperConnectString(), tmpDir, new File[] {tmpDir}); conf.setAllowLoopback(true); bks.add(startBookie(conf)); bkConfs.add(conf); }
protected org.apache.bookkeeper.conf.ServerConfiguration newServerConfiguration( int port, String zkServers, File journalDir, File[] ledgerDirs) { org.apache.bookkeeper.conf.ServerConfiguration conf = new org.apache.bookkeeper.conf.ServerConfiguration(); conf.setAllowLoopback(true); 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; }