Search in sources :

Example 16 with RequestHeader

use of org.apache.zookeeper_voltpatches.proto.RequestHeader in project voltdb by VoltDB.

the class ClientCnxn method close.

/**
     * Close the connection, which includes; send session disconnect to the
     * server, shutdown the send/event threads.
     *
     * @throws IOException
     */
public void close() throws IOException {
    if (LOG.isDebugEnabled()) {
        LOG.debug("Closing client for session: 0x" + Long.toHexString(getSessionId()));
    }
    try {
        RequestHeader h = new RequestHeader();
        h.setType(ZooDefs.OpCode.closeSession);
        submitRequest(h, null, null, null);
    } catch (InterruptedException e) {
    // ignore, close the send/event threads
    } finally {
        disconnect();
    }
}
Also used : RequestHeader(org.apache.zookeeper_voltpatches.proto.RequestHeader)

Example 17 with RequestHeader

use of org.apache.zookeeper_voltpatches.proto.RequestHeader in project voltdb by VoltDB.

the class ZooKeeper method getChildren.

/**
     * The Asynchronous version of getChildren. The request doesn't actually
     * until the asynchronous callback is called.
     *
     * @see #getChildren(String, Watcher)
     */
public void getChildren(final String path, Watcher watcher, ChildrenCallback cb, Object ctx) {
    verbotenThreadCheck();
    final String clientPath = path;
    PathUtils.validatePath(clientPath);
    // the watch contains the un-chroot path
    WatchRegistration wcb = null;
    if (watcher != null) {
        wcb = new ChildWatchRegistration(watcher, clientPath);
    }
    final String serverPath = prependChroot(clientPath);
    RequestHeader h = new RequestHeader();
    h.setType(ZooDefs.OpCode.getChildren);
    GetChildrenRequest request = new GetChildrenRequest();
    request.setPath(serverPath);
    request.setWatch(watcher != null);
    GetChildrenResponse response = new GetChildrenResponse();
    cnxn.queuePacket(h, new ReplyHeader(), request, response, cb, clientPath, serverPath, ctx, wcb);
}
Also used : GetChildrenRequest(org.apache.zookeeper_voltpatches.proto.GetChildrenRequest) ReplyHeader(org.apache.zookeeper_voltpatches.proto.ReplyHeader) GetChildrenResponse(org.apache.zookeeper_voltpatches.proto.GetChildrenResponse) RequestHeader(org.apache.zookeeper_voltpatches.proto.RequestHeader)

Example 18 with RequestHeader

use of org.apache.zookeeper_voltpatches.proto.RequestHeader in project voltdb by VoltDB.

the class ZooKeeper method setACL.

/**
     * The Asynchronous version of setACL. The request doesn't actually until
     * the asynchronous callback is called.
     *
     * @see #setACL(String, List, int)
     */
public void setACL(final String path, List<ACL> acl, int version, StatCallback cb, Object ctx) {
    verbotenThreadCheck();
    final String clientPath = path;
    PathUtils.validatePath(clientPath);
    final String serverPath = prependChroot(clientPath);
    RequestHeader h = new RequestHeader();
    h.setType(ZooDefs.OpCode.setACL);
    SetACLRequest request = new SetACLRequest();
    request.setPath(serverPath);
    request.setAcl(acl);
    request.setVersion(version);
    SetACLResponse response = new SetACLResponse();
    cnxn.queuePacket(h, new ReplyHeader(), request, response, cb, clientPath, serverPath, ctx, null);
}
Also used : ReplyHeader(org.apache.zookeeper_voltpatches.proto.ReplyHeader) SetACLRequest(org.apache.zookeeper_voltpatches.proto.SetACLRequest) RequestHeader(org.apache.zookeeper_voltpatches.proto.RequestHeader) SetACLResponse(org.apache.zookeeper_voltpatches.proto.SetACLResponse)

Example 19 with RequestHeader

use of org.apache.zookeeper_voltpatches.proto.RequestHeader in project voltdb by VoltDB.

the class ZooKeeper method exists.

/**
     * The Asynchronous version of exists. The request doesn't actually until
     * the asynchronous callback is called.
     *
     * @see #exists(String, boolean)
     */
public void exists(final String path, Watcher watcher, StatCallback cb, Object ctx) {
    verbotenThreadCheck();
    final String clientPath = path;
    PathUtils.validatePath(clientPath);
    // the watch contains the un-chroot path
    WatchRegistration wcb = null;
    if (watcher != null) {
        wcb = new ExistsWatchRegistration(watcher, clientPath);
    }
    final String serverPath = prependChroot(clientPath);
    RequestHeader h = new RequestHeader();
    h.setType(ZooDefs.OpCode.exists);
    ExistsRequest request = new ExistsRequest();
    request.setPath(serverPath);
    request.setWatch(watcher != null);
    SetDataResponse response = new SetDataResponse();
    cnxn.queuePacket(h, new ReplyHeader(), request, response, cb, clientPath, serverPath, ctx, wcb);
}
Also used : ExistsRequest(org.apache.zookeeper_voltpatches.proto.ExistsRequest) ReplyHeader(org.apache.zookeeper_voltpatches.proto.ReplyHeader) RequestHeader(org.apache.zookeeper_voltpatches.proto.RequestHeader) SetDataResponse(org.apache.zookeeper_voltpatches.proto.SetDataResponse)

Example 20 with RequestHeader

use of org.apache.zookeeper_voltpatches.proto.RequestHeader in project voltdb by VoltDB.

the class ZooKeeper method getACL.

/**
     * The Asynchronous version of getACL. The request doesn't actually until
     * the asynchronous callback is called.
     *
     * @see #getACL(String, Stat)
     */
public void getACL(final String path, Stat stat, ACLCallback cb, Object ctx) {
    verbotenThreadCheck();
    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_voltpatches.proto.ReplyHeader) GetACLRequest(org.apache.zookeeper_voltpatches.proto.GetACLRequest) RequestHeader(org.apache.zookeeper_voltpatches.proto.RequestHeader) GetACLResponse(org.apache.zookeeper_voltpatches.proto.GetACLResponse)

Aggregations

RequestHeader (org.apache.zookeeper_voltpatches.proto.RequestHeader)24 ReplyHeader (org.apache.zookeeper_voltpatches.proto.ReplyHeader)20 SetDataResponse (org.apache.zookeeper_voltpatches.proto.SetDataResponse)4 AuthPacket (org.apache.zookeeper_voltpatches.proto.AuthPacket)2 CreateRequest (org.apache.zookeeper_voltpatches.proto.CreateRequest)2 CreateResponse (org.apache.zookeeper_voltpatches.proto.CreateResponse)2 DeleteRequest (org.apache.zookeeper_voltpatches.proto.DeleteRequest)2 ExistsRequest (org.apache.zookeeper_voltpatches.proto.ExistsRequest)2 GetACLRequest (org.apache.zookeeper_voltpatches.proto.GetACLRequest)2 GetACLResponse (org.apache.zookeeper_voltpatches.proto.GetACLResponse)2 GetChildren2Request (org.apache.zookeeper_voltpatches.proto.GetChildren2Request)2 GetChildren2Response (org.apache.zookeeper_voltpatches.proto.GetChildren2Response)2 GetChildrenRequest (org.apache.zookeeper_voltpatches.proto.GetChildrenRequest)2 GetChildrenResponse (org.apache.zookeeper_voltpatches.proto.GetChildrenResponse)2 GetDataRequest (org.apache.zookeeper_voltpatches.proto.GetDataRequest)2 GetDataResponse (org.apache.zookeeper_voltpatches.proto.GetDataResponse)2 SetACLRequest (org.apache.zookeeper_voltpatches.proto.SetACLRequest)2 SetACLResponse (org.apache.zookeeper_voltpatches.proto.SetACLResponse)2 SetDataRequest (org.apache.zookeeper_voltpatches.proto.SetDataRequest)2 InputStream (java.io.InputStream)1