本文整理了Java中org.apache.bookkeeper.shims.zk.ZooKeeperServerShim
类的一些代码示例,展示了ZooKeeperServerShim
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperServerShim
类的具体详情如下:
包路径:org.apache.bookkeeper.shims.zk.ZooKeeperServerShim
类名称:ZooKeeperServerShim
[英]In order to be compatible with multiple versions of ZooKeeper. All parts of the ZooKeeper Server that are not cross-version compatible are encapsulated in an implementation of this class.
[中]以便与ZooKeeper的多个版本兼容。ZooKeeper服务器中所有不兼容跨版本的部分都封装在此类的实现中。
代码示例来源:origin: twitter/distributedlog
public void stop() throws Exception {
if (null != dlServer) {
this.dlServer.shutdown();
}
this.dlmEmulator.teardown();
if (null != this.zks) {
this.zks.stop();
}
for (File dir : tmpDirs) {
FileUtils.deleteDirectory(dir);
}
}
代码示例来源:origin: org.apache.bookkeeper/bookkeeper-server
public static ZooKeeperServerShim createServer(File snapDir, File logDir, int zkPort, int maxCC)
throws IOException {
ZooKeeperServerShim server = new ZooKeeperServerShimImpl();
server.initialize(snapDir, logDir, zkPort, maxCC);
return server;
}
代码示例来源:origin: org.apache.bookkeeper/bookkeeper-server
public static ZooKeeperServerShim runZookeeper(int maxCC, int zookeeperPort, File zkDir) throws IOException {
LOG.info("Starting ZK server");
ZooKeeperServerShim server = ZooKeeperServerShimFactory.createServer(zkDir, zkDir, zookeeperPort, maxCC);
server.start();
boolean b = waitForServerUp(InetAddress.getLoopbackAddress().getHostAddress() + ":" + zookeeperPort,
CONNECTION_TIMEOUT);
if (LOG.isDebugEnabled()) {
LOG.debug("ZooKeeper server up: {}", b);
}
return server;
}
代码示例来源:origin: twitter/distributedlog
@AfterClass
public static void shutdownZooKeeper() throws Exception {
zks.stop();
if (null != zkDir) {
FileUtils.deleteDirectory(zkDir);
}
}
}
代码示例来源:origin: twitter/distributedlog
@AfterClass
public static void teardownCluster() throws Exception {
bkutil.teardown();
zks.stop();
for (File dir : tmpDirs) {
FileUtils.deleteDirectory(dir);
}
}
代码示例来源:origin: twitter/distributedlog
@Test(timeout = 60000)
public void testRunZookeeperOnAnyPort() throws Exception {
Pair<ZooKeeperServerShim, Integer> serverAndPort1 = null;
Pair<ZooKeeperServerShim, Integer> serverAndPort2 = null;
Pair<ZooKeeperServerShim, Integer> serverAndPort3 = null;
try {
File zkTmpDir1 = IOUtils.createTempDir("zookeeper1", "distrlog");
serverAndPort1 = LocalDLMEmulator.runZookeeperOnAnyPort(7000, zkTmpDir1);
File zkTmpDir2 = IOUtils.createTempDir("zookeeper2", "distrlog");
serverAndPort2 = LocalDLMEmulator.runZookeeperOnAnyPort(7000, zkTmpDir2);
File zkTmpDir3 = IOUtils.createTempDir("zookeeper3", "distrlog");
serverAndPort3 = LocalDLMEmulator.runZookeeperOnAnyPort(7000, zkTmpDir3);
} catch (Exception ex) {
if (null != serverAndPort1) {
serverAndPort1.getLeft().stop();
}
if (null != serverAndPort2) {
serverAndPort2.getLeft().stop();
}
if (null != serverAndPort3) {
serverAndPort3.getLeft().stop();
}
}
}
}
代码示例来源:origin: org.apache.distributedlog/distributedlog-service
public void stop() throws Exception {
if (null != dlServer) {
this.dlServer.shutdown();
}
this.dlmEmulator.teardown();
if (null != this.zks) {
this.zks.stop();
}
for (File dir : tmpDirs) {
FileUtils.forceDeleteOnExit(dir);
}
}
代码示例来源:origin: org.apache.bookkeeper/bookkeeper-server
zks.stop();
内容来源于网络,如有侵权,请联系作者删除!