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


Java KeeperException.UnimplementedException方法代码示例

本文整理汇总了Java中org.apache.zookeeper.KeeperException.UnimplementedException方法的典型用法代码示例。如果您正苦于以下问题:Java KeeperException.UnimplementedException方法的具体用法?Java KeeperException.UnimplementedException怎么用?Java KeeperException.UnimplementedException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.zookeeper.KeeperException的用法示例。


在下文中一共展示了KeeperException.UnimplementedException方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processRequest

import org.apache.zookeeper.KeeperException; //导入方法依赖的package包/类
public void processRequest(Request request) throws RequestProcessorException {
    KeeperException ke = new KeeperException.UnimplementedException();
    request.setException(ke);
    ReplyHeader rh = new ReplyHeader(request.cxid, request.zxid, ke.code().intValue());
    try {
        request.cnxn.sendResponse(rh, null, "response");
    } catch (IOException e) {
        throw new RequestProcessorException("Can't send the response", e);
    }

    request.cnxn.sendCloseSession();
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:13,代码来源:UnimplementedRequestProcessor.java

示例2: testStandaloneReconfigFails

import org.apache.zookeeper.KeeperException; //导入方法依赖的package包/类
/**
 * Verify that reconfiguration in standalone mode fails with
 * KeeperException.UnimplementedException.
 */
@Test
public void testStandaloneReconfigFails() throws Exception {
    ClientBase.setupTestEnv();

    final int CLIENT_PORT = PortAssignment.unique();
    final String HOSTPORT = "127.0.0.1:" + CLIENT_PORT;

    File tmpDir = ClientBase.createTmpDir();
    ZooKeeperServer zks = new ZooKeeperServer(tmpDir, tmpDir, 3000);

    ServerCnxnFactory f = ServerCnxnFactory.createFactory(CLIENT_PORT, -1);
    f.startup(zks);
    Assert.assertTrue("waiting for server being up ", ClientBase
            .waitForServerUp(HOSTPORT, CONNECTION_TIMEOUT));

    CountdownWatcher watcher = new CountdownWatcher();
    ZooKeeper zk = new ZooKeeper(HOSTPORT, CONNECTION_TIMEOUT, watcher);
    ZooKeeperAdmin zkAdmin = new ZooKeeperAdmin(HOSTPORT, CONNECTION_TIMEOUT, watcher);
    watcher.waitForConnected(CONNECTION_TIMEOUT);

    List<String> joiners = new ArrayList<String>();
    joiners.add("server.2=localhost:1234:1235;1236");
    // generate some transactions that will get logged
    try {
        zkAdmin.addAuthInfo("digest", "super:test".getBytes());
        zkAdmin.reconfigure(joiners, null, null, -1, new Stat());
        Assert.fail("Reconfiguration in standalone should trigger " +
                    "UnimplementedException");
    } catch (KeeperException.UnimplementedException ex) {
        // expected
    }
    zk.close();

    zks.shutdown();
    f.shutdown();
    Assert.assertTrue("waiting for server being down ", ClientBase
            .waitForServerDown(HOSTPORT, CONNECTION_TIMEOUT));
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:43,代码来源:StandaloneTest.java


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