本文整理匯總了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));
}