本文整理汇总了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();
}
示例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));
}