Search in sources :

Example 36 with ReplyHeader

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);
}
Also used : ReplyHeader(org.apache.zookeeper.proto.ReplyHeader) GetACLRequest(org.apache.zookeeper.proto.GetACLRequest) RequestHeader(org.apache.zookeeper.proto.RequestHeader) GetACLResponse(org.apache.zookeeper.proto.GetACLResponse)

Example 37 with ReplyHeader

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);
}
Also used : ReplyHeader(org.apache.zookeeper.proto.ReplyHeader) RequestHeader(org.apache.zookeeper.proto.RequestHeader) Record(org.apache.jute.Record)

Example 38 with ReplyHeader

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;
}
Also used : ReplyHeader(org.apache.zookeeper.proto.ReplyHeader) AuthPacket(org.apache.zookeeper.proto.AuthPacket)

Example 39 with ReplyHeader

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();
}
Also used : ReplyHeader(org.apache.zookeeper.proto.ReplyHeader) IOException(java.io.IOException) KeeperException(org.apache.zookeeper.KeeperException)

Aggregations

ReplyHeader (org.apache.zookeeper.proto.ReplyHeader)39 RequestHeader (org.apache.zookeeper.proto.RequestHeader)33 GetDataResponse (org.apache.zookeeper.proto.GetDataResponse)7 Record (org.apache.jute.Record)6 GetDataRequest (org.apache.zookeeper.proto.GetDataRequest)5 SetDataResponse (org.apache.zookeeper.proto.SetDataResponse)5 IOException (java.io.IOException)4 ExistsRequest (org.apache.zookeeper.proto.ExistsRequest)4 AuthPacket (org.apache.zookeeper.proto.AuthPacket)3 Create2Response (org.apache.zookeeper.proto.Create2Response)3 CreateResponse (org.apache.zookeeper.proto.CreateResponse)3 GetACLRequest (org.apache.zookeeper.proto.GetACLRequest)3 GetACLResponse (org.apache.zookeeper.proto.GetACLResponse)3 GetChildren2Request (org.apache.zookeeper.proto.GetChildren2Request)3 GetChildren2Response (org.apache.zookeeper.proto.GetChildren2Response)3 GetChildrenRequest (org.apache.zookeeper.proto.GetChildrenRequest)3 GetChildrenResponse (org.apache.zookeeper.proto.GetChildrenResponse)3 SetACLResponse (org.apache.zookeeper.proto.SetACLResponse)3 KeeperException (org.apache.zookeeper.KeeperException)2 Code (org.apache.zookeeper.KeeperException.Code)2