use of org.apache.zookeeper.proto.ReplyHeader in project zookeeper by apache.
the class ZooKeeper method getACL.
/**
* The asynchronous version of getACL.
*
* @see #getACL(String, Stat)
*/
public void getACL(final String path, Stat stat, ACLCallback cb, Object ctx) {
final String clientPath = path;
PathUtils.validatePath(clientPath);
final String serverPath = prependChroot(clientPath);
RequestHeader h = new RequestHeader();
h.setType(ZooDefs.OpCode.getACL);
GetACLRequest request = new GetACLRequest();
request.setPath(serverPath);
GetACLResponse response = new GetACLResponse();
cnxn.queuePacket(h, new ReplyHeader(), request, response, cb, clientPath, serverPath, ctx, null);
}
use of org.apache.zookeeper.proto.ReplyHeader in project zookeeper by apache.
the class ZooKeeper method removeWatches.
private void removeWatches(int opCode, String path, Watcher watcher, WatcherType watcherType, boolean local, VoidCallback cb, Object ctx) {
PathUtils.validatePath(path);
final String clientPath = path;
final String serverPath = prependChroot(clientPath);
WatchDeregistration wcb = new WatchDeregistration(clientPath, watcher, watcherType, local, watchManager);
RequestHeader h = new RequestHeader();
h.setType(opCode);
Record request = getRemoveWatchesRequest(opCode, watcherType, serverPath);
cnxn.queuePacket(h, new ReplyHeader(), request, null, cb, clientPath, serverPath, ctx, null, wcb);
}
use of org.apache.zookeeper.proto.ReplyHeader in project zookeeper by apache.
the class ClientCnxn method submitRequest.
public ReplyHeader submitRequest(RequestHeader h, Record request, Record response, WatchRegistration watchRegistration, WatchDeregistration watchDeregistration) throws InterruptedException {
ReplyHeader r = new ReplyHeader();
Packet packet = queuePacket(h, r, request, response, null, null, null, null, watchRegistration, watchDeregistration);
synchronized (packet) {
while (!packet.finished) {
packet.wait();
}
}
return r;
}
use of org.apache.zookeeper.proto.ReplyHeader in project zookeeper by apache.
the class UnimplementedRequestProcessor method processRequest.
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();
}
Aggregations