當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。