当前位置: 首页>>代码示例>>Java>>正文


Java TestableZooKeeper.testableWaitForShutdown方法代码示例

本文整理汇总了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());
    }
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:17,代码来源:ClientTest.java

示例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);
}
 
开发者ID:sereca,项目名称:SecureKeeper,代码行数:23,代码来源:ClientTest.java

示例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);
    }
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:15,代码来源:ClientTest.java


注:本文中的org.apache.zookeeper.TestableZooKeeper.testableWaitForShutdown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。