本文整理汇总了Java中org.apache.zookeeper.TestableZooKeeper.testableWaitForShutdown方法的典型用法代码示例。如果您正苦于以下问题:Java TestableZooKeeper.testableWaitForShutdown方法的具体用法?Java TestableZooKeeper.testableWaitForShutdown怎么用?Java TestableZooKeeper.testableWaitForShutdown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.zookeeper.TestableZooKeeper
的用法示例。
在下文中一共展示了TestableZooKeeper.testableWaitForShutdown方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testTestability
import org.apache.zookeeper.TestableZooKeeper; //导入方法依赖的package包/类
/** Exercise the testable functions, verify tostring, etc... */
@Test
public void testTestability() throws Exception {
TestableZooKeeper zk = createClient();
try {
LOG.info("{}",zk.testableLocalSocketAddress());
LOG.info("{}",zk.testableRemoteSocketAddress());
LOG.info("{}",zk.toString());
} finally {
zk.close();
zk.testableWaitForShutdown(CONNECTION_TIMEOUT);
LOG.info("{}",zk.testableLocalSocketAddress());
LOG.info("{}",zk.testableRemoteSocketAddress());
LOG.info("{}",zk.toString());
}
}
示例2: testNonExistingOpCode
import org.apache.zookeeper.TestableZooKeeper; //导入方法依赖的package包/类
/**
* We create a perfectly valid 'exists' request, except that the opcode is wrong.
* @return
* @throws Exception
*/
@Test
public void testNonExistingOpCode() throws Exception {
TestableZooKeeper zk = createClient();
final String path = "/m1";
RequestHeader h = new RequestHeader();
h.setType(888); // This code does not exists
ExistsRequest request = new ExistsRequest();
request.setPath(path);
request.setWatch(false);
ExistsResponse response = new ExistsResponse();
ReplyHeader r = zk.submitRequest(h, request, response, null);
Assert.assertEquals(r.getErr(), Code.UNIMPLEMENTED.intValue());
zk.testableWaitForShutdown(CONNECTION_TIMEOUT);
}
示例3: run
import org.apache.zookeeper.TestableZooKeeper; //导入方法依赖的package包/类
public void run() {
try {
for (; current < count; current++) {
TestableZooKeeper zk = createClient();
zk.close();
// we've asked to close, wait for it to finish closing
// all the sub-threads otw the selector may not be
// closed when we check (false positive on test Assert.failure
zk.testableWaitForShutdown(CONNECTION_TIMEOUT);
}
} catch (Throwable t) {
LOG.error("test Assert.failed", t);
}
}